home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 June: Reference Library / Dev.CD Jun 94.toast / Technical Documentation / Mac Tech Notes (DocViewer) / Memory / TN-Memory < prev   
MacBinary  |  1994-04-27  |  358.5 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Thu Jul 15 15:43:07 1993, modified Wed Apr 27 06:14:16 1994, creator 'HLX2', type 'ONLN', 356245 bytes "TN-Memory" , at 0x57015 10558 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 54 4e 2d 4d 65 6d | 6f 72 79 00 00 00 00 00 |..TN-Mem|ory.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 05 6f 95 00 | 00 29 3e a8 6b 63 cb a9 |.....o..|.)>.kc..|
|00000060| e3 eb 78 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..x.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 e6 7e 00 00 |........|.....~..|
|00000080| 4e 6f 74 69 63 65 3a 20 | 54 68 65 20 69 6e 66 6f |Notice: |The info|
|00000090| 72 6d 61 74 69 6f 6e 20 | 69 6e 20 74 68 69 73 20 |rmation |in this |
|000000a0| 54 65 63 68 6e 69 63 61 | 6c 20 4e 6f 74 65 20 63 |Technica|l Note c|
|000000b0| 61 6e 20 6e 6f 77 20 62 | 65 20 66 6f 75 6e 64 20 |an now b|e found |
|000000c0| 69 6e 20 49 6e 73 69 64 | 65 20 4d 61 63 69 6e 74 |in Insid|e Macint|
|000000d0| 6f 73 68 3a 4d 65 6d 6f | 72 79 20 70 61 67 65 73 |osh:Memo|ry pages|
|000000e0| 20 34 2d 31 33 20 74 68 | 72 6f 75 67 68 20 34 2d | 4-13 th|rough 4-|
|000000f0| 31 35 2e 20 20 54 68 69 | 73 20 6e 6f 74 65 20 77 |15. Thi|s note w|
|00000100| 69 6c 6c 20 62 65 20 72 | 65 6d 6f 76 65 64 20 66 |ill be r|emoved f|
|00000110| 72 6f 6d 20 74 68 65 20 | 54 65 63 68 6e 69 63 61 |rom the |Technica|
|00000120| 6c 20 4e 6f 74 65 20 6c | 69 62 72 61 72 79 20 69 |l Note l|ibrary i|
|00000130| 6e 20 74 68 65 20 6e 65 | 61 72 20 66 75 74 75 72 |n the ne|ar futur|
|00000140| 65 2e 0d 4d 45 20 31 20 | 2d 20 52 65 67 69 73 74 |e..ME 1 |- Regist|
|00000150| 65 72 20 41 35 20 57 69 | 74 68 69 6e 20 47 72 6f |er A5 Wi|thin Gro|
|00000160| 77 5a 6f 6e 65 20 46 75 | 6e 63 74 69 6f 6e 73 0d |wZone Fu|nctions.|
|00000170| 4d 65 6d 6f 72 79 09 4d | 2e 4d 45 2e 41 35 49 6e |Memory.M|.ME.A5In|
|00000180| 47 72 6f 77 5a 6f 6e 65 | 50 72 6f 63 73 0d 52 65 |GrowZone|Procs.Re|
|00000190| 76 69 73 65 64 20 62 79 | 3a 09 09 4d 61 72 63 68 |vised by|:..March|
|000001a0| 20 31 39 38 38 0d 57 72 | 69 74 74 65 6e 20 62 79 | 1988.Wr|itten by|
|000001b0| 3a 09 43 68 72 69 73 20 | 44 65 72 6f 73 73 69 09 |:.Chris |Derossi.|
|000001c0| 4a 75 6c 79 20 31 39 38 | 37 0d 49 66 20 79 6f 75 |July 198|7.If you|
|000001d0| 20 68 61 76 65 20 61 20 | 67 72 6f 77 20 7a 6f 6e | have a |grow zon|
|000001e0| 65 20 66 75 6e 63 74 69 | 6f 6e 2c 20 69 74 20 6d |e functi|on, it m|
|000001f0| 61 79 20 67 65 74 20 63 | 61 6c 6c 65 64 20 77 68 |ay get c|alled wh|
|00000200| 65 6e 20 61 20 73 79 73 | 74 65 6d 20 72 6f 75 74 |en a sys|tem rout|
|00000210| 69 6e 65 20 69 73 20 74 | 72 79 69 6e 67 20 74 6f |ine is t|rying to|
|00000220| 20 61 6c 6c 6f 63 61 74 | 65 20 6d 65 6d 6f 72 79 | allocat|e memory|
|00000230| 2e 20 42 65 63 61 75 73 | 65 20 74 68 69 73 20 63 |. Becaus|e this c|
|00000240| 61 6e 20 68 61 70 70 65 | 6e 2c 20 79 6f 75 20 63 |an happe|n, you c|
|00000250| 61 6e d5 74 20 62 65 20 | 67 75 61 72 61 6e 74 65 |an.t be |guarante|
|00000260| 65 64 20 74 68 61 74 20 | 72 65 67 69 73 74 65 72 |ed that |register|
|00000270| 20 41 35 20 77 69 6c 6c | 20 62 65 20 63 6f 72 72 | A5 will| be corr|
|00000280| 65 63 74 2e 0d 49 66 20 | 79 6f 75 72 20 67 72 6f |ect..If |your gro|
|00000290| 77 20 7a 6f 6e 65 20 66 | 75 6e 63 74 69 6f 6e 20 |w zone f|unction |
|000002a0| 64 65 70 65 6e 64 73 20 | 6f 6e 20 41 35 2c 20 79 |depends |on A5, y|
|000002b0| 6f 75 20 73 68 6f 75 6c | 64 20 73 61 76 65 20 72 |ou shoul|d save r|
|000002c0| 65 67 69 73 74 65 72 20 | 41 35 2c 20 6c 6f 61 64 |egister |A5, load|
|000002d0| 20 41 35 20 66 72 6f 6d | 20 74 68 65 20 6c 6f 77 | A5 from| the low|
|000002e0| 2d 6d 65 6d 6f 72 79 20 | 67 6c 6f 62 61 6c 20 43 |-memory |global C|
|000002f0| 75 72 72 65 6e 74 41 35 | 20 28 61 20 6c 6f 6e 67 |urrentA5| (a long|
|00000300| 20 77 6f 72 64 20 61 74 | 20 24 39 30 34 29 2c 20 | word at| $904), |
|00000310| 61 6e 64 20 72 65 73 74 | 6f 72 65 20 74 68 65 20 |and rest|ore the |
|00000320| 63 61 6c 6c 65 72 d5 73 | 20 41 35 20 62 65 66 6f |caller.s| A5 befo|
|00000330| 72 65 20 79 6f 75 20 65 | 78 69 74 2e 0d 46 72 6f |re you e|xit..Fro|
|00000340| 6d 20 68 69 67 68 2d 6c | 65 76 65 6c 20 6c 61 6e |m high-l|evel lan|
|00000350| 67 75 61 67 65 73 2c 20 | 79 6f 75 20 63 61 6e 20 |guages, |you can |
|00000360| 61 6c 73 6f 20 75 73 65 | 20 74 68 65 20 4f 70 65 |also use| the Ope|
|00000370| 72 61 74 69 6e 67 20 53 | 79 73 74 65 6d 20 55 74 |rating S|ystem Ut|
|00000380| 69 6c 69 74 79 20 63 61 | 6c 6c 73 20 53 65 74 55 |ility ca|lls SetU|
|00000390| 70 41 35 20 61 6e 64 20 | 52 65 73 74 6f 72 65 41 |pA5 and |RestoreA|
|000003a0| 35 20 28 70 61 67 65 20 | 33 38 36 20 6f 66 20 49 |5 (page |386 of I|
|000003b0| 6e 73 69 64 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |nside Ma|cintosh |
|000003c0| 56 6f 6c 75 6d 65 20 49 | 49 29 2e 20 53 65 74 55 |Volume I|I). SetU|
|000003d0| 70 41 35 20 73 74 6f 72 | 65 73 20 74 68 65 20 d4 |pA5 stor|es the .|
|000003e0| 6f 6c 64 d5 20 41 35 20 | 6f 6e 20 74 68 65 20 73 |old. A5 |on the s|
|000003f0| 74 61 63 6b 20 61 6e 64 | 20 70 75 74 73 20 74 68 |tack and| puts th|
|00000400| 65 20 76 61 6c 75 65 20 | 73 74 6f 72 65 64 20 61 |e value |stored a|
|00000410| 74 20 43 75 72 72 65 6e | 74 41 35 20 69 6e 74 6f |t Curren|tA5 into|
|00000420| 20 41 35 2e 20 4d 61 6b | 65 20 73 75 72 65 20 74 | A5. Mak|e sure t|
|00000430| 6f 20 63 61 6c 6c 20 52 | 65 73 74 6f 72 65 41 35 |o call R|estoreA5|
|00000440| 20 77 68 65 6e 20 79 6f | 75 d5 72 65 20 64 6f 6e | when yo|u.re don|
|00000450| 65 20 73 6f 20 74 68 61 | 74 20 69 74 20 63 61 6e |e so tha|t it can|
|00000460| 20 70 6f 70 20 74 68 65 | 20 73 61 76 65 64 20 76 | pop the| saved v|
|00000470| 61 6c 75 65 20 6f 66 20 | 41 35 20 6f 66 66 20 74 |alue of |A5 off t|
|00000480| 68 65 20 73 74 61 63 6b | 2e 0d 59 6f 75 72 20 67 |he stack|..Your g|
|00000490| 72 6f 77 20 7a 6f 6e 65 | 20 66 75 6e 63 74 69 6f |row zone| functio|
|000004a0| 6e 20 64 65 70 65 6e 64 | 73 20 6f 6e 20 41 35 20 |n depend|s on A5 |
|000004b0| 69 66 20 69 74 20 64 6f | 65 73 20 61 6e 79 20 6f |if it do|es any o|
|000004c0| 66 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 3a |f the fo|llowing:|
|000004d0| 0d a5 09 41 63 63 65 73 | 73 65 73 20 79 6f 75 72 |...Acces|ses your|
|000004e0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e d5 73 20 67 | applica|tion.s g|
|000004f0| 6c 6f 62 61 6c 20 76 61 | 72 69 61 62 6c 65 73 20 |lobal va|riables |
|00000500| 28 77 68 69 63 68 20 61 | 72 65 20 73 74 6f 72 65 |(which a|re store|
|00000510| 64 20 61 74 20 6e 65 67 | 61 74 69 76 65 20 6f 66 |d at neg|ative of|
|00000520| 66 73 65 74 73 20 66 72 | 6f 6d 20 41 35 29 2e 0d |fsets fr|om A5)..|
|00000530| a5 09 41 63 63 65 73 73 | 65 73 20 74 68 65 20 51 |..Access|es the Q|
|00000540| 75 69 63 6b 44 72 61 77 | 20 67 6c 6f 62 61 6c 73 |uickDraw| globals|
|00000550| 2e 20 28 41 35 20 63 6f | 6e 74 61 69 6e 73 20 74 |. (A5 co|ntains t|
|00000560| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 61 20 |he addre|ss of a |
|00000570| 70 6f 69 6e 74 65 72 20 | 74 6f 20 74 68 65 20 51 |pointer |to the Q|
|00000580| 75 69 63 6b 44 72 61 77 | 20 09 67 6c 6f 62 61 6c |uickDraw| .global|
|00000590| 20 76 61 72 69 61 62 6c | 65 73 2e 29 0d a5 09 4d | variabl|es.)...M|
|000005a0| 61 6b 65 73 20 61 6e 79 | 20 52 4f 4d 20 74 72 61 |akes any| ROM tra|
|000005b0| 70 20 63 61 6c 6c 73 2e | 0d a5 09 4d 61 6b 65 73 |p calls.|...Makes|
|000005c0| 20 61 6e 79 20 69 6e 74 | 65 72 73 65 67 6d 65 6e | any int|ersegmen|
|000005d0| 74 20 63 61 6c 6c 73 20 | 74 6f 20 72 6f 75 74 69 |t calls |to routi|
|000005e0| 6e 65 73 20 69 6e 20 79 | 6f 75 72 20 61 70 70 6c |nes in y|our appl|
|000005f0| 69 63 61 74 69 6f 6e 2e | 0d 54 6f 20 64 6f 20 61 |ication.|.To do a|
|00000600| 6e 79 20 6f 66 20 74 68 | 65 73 65 2c 20 41 35 20 |ny of th|ese, A5 |
|00000610| 6e 65 65 64 73 20 74 6f | 20 63 6f 6e 74 61 69 6e |needs to| contain|
|00000620| 20 74 68 65 20 76 61 6c | 75 65 20 66 72 6f 6d 20 | the val|ue from |
|00000630| 43 75 72 72 65 6e 74 41 | 35 2e 20 50 6c 65 61 73 |CurrentA|5. Pleas|
|00000640| 65 20 6e 6f 74 65 20 74 | 68 61 74 20 74 68 69 73 |e note t|hat this|
|00000650| 20 69 73 20 64 69 66 66 | 65 72 65 6e 74 20 74 68 | is diff|erent th|
|00000660| 61 6e 20 74 68 65 20 6d | 65 74 68 6f 64 20 66 6f |an the m|ethod fo|
|00000670| 72 20 63 61 6c 6c 69 6e | 67 20 74 68 65 20 52 4f |r callin|g the RO|
|00000680| 4d 20 66 72 6f 6d 20 74 | 72 61 70 20 70 61 74 63 |M from t|rap patc|
|00000690| 68 65 73 2c 20 77 68 65 | 72 65 20 41 35 20 73 68 |hes, whe|re A5 sh|
|000006a0| 6f 75 6c 64 20 72 65 74 | 61 69 6e 20 74 68 65 20 |ould ret|ain the |
|000006b0| 76 61 6c 75 65 20 69 74 | 20 68 61 64 20 75 70 6f |value it| had upo|
|000006c0| 6e 20 65 6e 74 72 79 20 | 74 6f 20 79 6f 75 72 20 |n entry |to your |
|000006d0| 70 61 74 63 68 2e 0d 46 | 75 72 74 68 65 72 20 52 |patch..F|urther R|
|000006e0| 65 66 65 72 65 6e 63 65 | 3a 0d a5 09 54 68 65 20 |eference|:...The |
|000006f0| 4d 65 6d 6f 72 79 20 4d | 61 6e 61 67 65 72 0d a5 |Memory M|anager..|
|00000700| 09 54 65 63 68 6e 69 63 | 61 6c 20 4e 6f 74 65 20 |.Technic|al Note |
|00000710| 4d 2e 4d 45 2e 47 72 6f | 77 5a 6f 6e 65 41 35 20 |M.ME.Gro|wZoneA5 |
|00000720| d1 0d 09 09 52 65 67 69 | 73 74 65 72 20 41 35 20 |....Regi|ster A5 |
|00000730| 57 69 74 68 69 6e 20 54 | 72 61 70 20 50 61 74 63 |Within T|rap Patc|
|00000740| 68 65 73 0d 4d 45 20 32 | 20 2d 20 48 61 6e 64 6c |hes.ME 2| - Handl|
|00000750| 65 73 20 56 53 20 50 6f | 69 6e 74 65 72 73 d1 49 |es VS Po|inters.I|
|00000760| 64 65 6e 74 69 74 79 20 | 43 72 69 73 69 73 0d 4d |dentity |Crisis.M|
|00000770| 65 6d 6f 72 79 09 4d 2e | 4d 45 2e 48 61 6e 64 6c |emory.M.|ME.Handl|
|00000780| 65 56 53 50 6f 69 6e 74 | 65 72 0d 52 65 76 69 73 |eVSPoint|er.Revis|
|00000790| 65 64 20 62 79 3a 09 09 | 4d 61 72 63 68 20 31 39 |ed by:..|March 19|
|000007a0| 38 38 0d 57 72 69 74 74 | 65 6e 20 62 79 3a 09 4a |88.Writt|en by:.J|
|000007b0| 69 6d 20 46 72 69 65 64 | 6c 61 6e 64 65 72 09 53 |im Fried|lander.S|
|000007c0| 65 70 74 65 6d 62 65 72 | 20 31 39 38 37 0d 41 20 |eptember| 1987.A |
|000007d0| 68 61 6e 64 6c 65 20 69 | 73 20 61 20 68 61 6e 64 |handle i|s a hand|
|000007e0| 6c 65 20 61 6e 64 20 61 | 20 70 6f 69 6e 74 65 72 |le and a| pointer|
|000007f0| 20 69 73 20 61 20 70 6f | 69 6e 74 65 72 2e 20 41 | is a po|inter. A|
|00000800| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 73 68 6f 75 |pplicati|ons shou|
|00000810| 6c 64 20 61 76 6f 69 64 | 20 65 6d 62 65 64 64 69 |ld avoid| embeddi|
|00000820| 6e 67 20 6e 6f 6e 2d 72 | 65 6c 6f 63 61 74 61 62 |ng non-r|elocatab|
|00000830| 6c 65 20 6f 62 6a 65 63 | 74 73 20 28 74 68 61 74 |le objec|ts (that|
|00000840| 20 74 68 65 20 73 79 73 | 74 65 6d 20 61 73 73 75 | the sys|tem assu|
|00000850| 6d 65 73 20 77 69 6c 6c | 20 6e 65 76 65 72 20 6d |mes will| never m|
|00000860| 6f 76 65 29 20 69 6e 20 | 68 61 6e 64 6c 65 73 2e |ove) in |handles.|
|00000870| 0d 49 6e 20 6f 72 64 65 | 72 20 74 6f 20 61 76 6f |.In orde|r to avo|
|00000880| 69 64 20 66 72 61 67 6d | 65 6e 74 61 74 69 6f 6e |id fragm|entation|
|00000890| 2c 20 73 6f 6d 65 20 61 | 70 70 6c 69 63 61 74 69 |, some a|pplicati|
|000008a0| 6f 6e 73 20 65 6d 62 65 | 64 20 70 6f 69 6e 74 65 |ons embe|d pointe|
|000008b0| 72 73 20 28 6e 6f 6e 2d | 72 65 6c 6f 63 61 74 61 |rs (non-|relocata|
|000008c0| 62 6c 65 20 6d 65 6d 6f | 72 79 20 6d 61 6e 61 67 |ble memo|ry manag|
|000008d0| 65 72 20 6f 62 6a 65 63 | 74 73 29 20 69 6e 20 68 |er objec|ts) in h|
|000008e0| 61 6e 64 6c 65 73 2c 20 | 73 6f 20 74 68 61 74 20 |andles, |so that |
|000008f0| 74 68 65 20 68 61 6e 64 | 6c 65 73 20 63 61 6e 20 |the hand|les can |
|00000900| 62 65 20 6d 6f 76 65 64 | 20 61 72 6f 75 6e 64 20 |be moved| around |
|00000910| 61 73 20 6e 65 65 64 65 | 64 2e 20 54 68 69 73 20 |as neede|d. This |
|00000920| 63 61 6e 20 63 61 75 73 | 65 20 73 65 76 65 72 61 |can caus|e severa|
|00000930| 6c 20 70 72 6f 62 6c 65 | 6d 73 2c 20 65 73 70 65 |l proble|ms, espe|
|00000940| 63 69 61 6c 6c 79 20 77 | 69 74 68 20 74 68 65 20 |cially w|ith the |
|00000950| 4d 61 63 69 6e 74 6f 73 | 68 20 49 49 2c 20 61 6e |Macintos|h II, an|
|00000960| 64 20 73 68 6f 75 6c 64 | 20 62 65 20 61 76 6f 69 |d should| be avoi|
|00000970| 64 65 64 2e 0d 46 6f 72 | 20 65 78 61 6d 70 6c 65 |ded..For| example|
|00000980| 2c 20 75 73 65 20 6f 66 | 20 61 20 68 61 6e 64 6c |, use of| a handl|
|00000990| 65 20 74 6f 20 73 74 6f | 72 65 20 61 20 47 72 61 |e to sto|re a Gra|
|000009a0| 66 50 6f 72 74 20 63 61 | 6e 20 62 65 20 70 61 72 |fPort ca|n be par|
|000009b0| 74 69 63 75 6c 61 72 6c | 79 20 64 61 6e 67 65 72 |ticularl|y danger|
|000009c0| 6f 75 73 2e 20 41 20 47 | 72 61 66 50 6f 72 74 20 |ous. A G|rafPort |
|000009d0| 6d 75 73 74 20 6e 6f 74 | 20 6d 6f 76 65 20 62 65 |must not| move be|
|000009e0| 74 77 65 65 6e 20 74 68 | 65 20 74 69 6d 65 20 74 |tween th|e time t|
|000009f0| 68 61 74 20 69 74 20 69 | 73 20 6f 70 65 6e 65 64 |hat it i|s opened|
|00000a00| 20 28 4f 70 65 6e 50 6f | 72 74 2c 20 4e 65 77 57 | (OpenPo|rt, NewW|
|00000a10| 69 6e 64 6f 77 2c 20 4e | 65 77 44 69 61 6c 6f 67 |indow, N|ewDialog|
|00000a20| 2c 20 65 74 63 2e 29 20 | 61 6e 64 20 74 68 65 20 |, etc.) |and the |
|00000a30| 74 69 6d 65 20 74 68 61 | 74 20 69 74 20 69 73 20 |time tha|t it is |
|00000a40| 63 6c 6f 73 65 64 20 28 | 43 6c 6f 73 65 50 6f 72 |closed (|ClosePor|
|00000a50| 74 2c 20 44 69 73 70 6f | 73 65 57 69 6e 64 6f 77 |t, Dispo|seWindow|
|00000a60| 2c 20 44 69 73 70 6f 73 | 44 69 61 6c 6f 67 2c 20 |, Dispos|Dialog, |
|00000a70| 65 74 63 2e 29 2e 20 43 | 6f 6c 6f 72 20 51 75 69 |etc.). C|olor Qui|
|00000a80| 63 6b 44 72 61 77 20 6b | 65 65 70 73 20 61 20 6c |ckDraw k|eeps a l|
|00000a90| 69 73 74 20 6f 66 20 6f | 70 65 6e 20 70 6f 72 74 |ist of o|pen port|
|00000aa0| 73 20 61 6e 64 20 70 6f | 69 6e 74 65 72 73 20 74 |s and po|inters t|
|00000ab0| 6f 20 74 68 65 6d 2c 20 | 73 6f 2c 20 69 66 20 79 |o them, |so, if y|
|00000ac0| 6f 75 20 63 72 65 61 74 | 65 20 61 20 47 72 61 66 |ou creat|e a Graf|
|00000ad0| 50 6f 72 74 20 61 6e 64 | 20 69 74 20 6d 6f 76 65 |Port and| it move|
|00000ae0| 73 20 77 68 69 6c 65 20 | 73 74 69 6c 6c 20 6f 70 |s while |still op|
|00000af0| 65 6e 2c 20 43 6f 6c 6f | 72 20 51 75 69 63 6b 44 |en, Colo|r QuickD|
|00000b00| 72 61 77 20 77 69 6c 6c | 20 28 75 6e 6b 6e 6f 77 |raw will| (unknow|
|00000b10| 69 6e 67 6c 79 29 20 68 | 61 76 65 20 61 20 70 6f |ingly) h|ave a po|
|00000b20| 69 6e 74 65 72 20 74 6f | 20 6f 75 74 65 72 20 73 |inter to| outer s|
|00000b30| 70 61 63 65 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |pace ins|tead of |
|00000b40| 61 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 47 |a pointe|r to a G|
|00000b50| 72 61 66 50 6f 72 74 2e | 20 57 68 65 6e 20 69 74 |rafPort.| When it|
|00000b60| 20 6e 65 65 64 73 20 74 | 6f 20 75 73 65 20 74 68 | needs t|o use th|
|00000b70| 61 74 20 70 6f 69 6e 74 | 65 72 2c 20 69 74 20 77 |at point|er, it w|
|00000b80| 69 6c 6c 20 67 65 74 20 | 68 6f 70 65 6c 65 73 73 |ill get |hopeless|
|00000b90| 6c 79 20 63 6f 6e 66 75 | 73 65 64 20 61 6e 64 20 |ly confu|sed and |
|00000ba0| 70 72 6f 62 61 62 6c 79 | 20 69 73 73 75 65 20 61 |probably| issue a|
|00000bb0| 20 73 79 73 74 65 6d 20 | 65 72 72 6f 72 20 74 6f | system |error to|
|00000bc0| 20 6c 65 74 20 79 6f 75 | 20 6b 6e 6f 77 2e 20 0d | let you| know. .|
|00000bd0| 41 73 20 61 6e 20 61 73 | 69 64 65 2c 20 69 66 20 |As an as|ide, if |
|00000be0| 79 6f 75 20 6f 70 65 6e | 20 61 20 70 6f 72 74 20 |you open| a port |
|00000bf0| 62 79 20 63 61 6c 6c 69 | 6e 67 20 4f 70 65 6e 50 |by calli|ng OpenP|
|00000c00| 6f 72 74 20 6f 72 20 4f | 70 65 6e 43 50 6f 72 74 |ort or O|penCPort|
|00000c10| 2c 20 79 6f 75 20 73 68 | 6f 75 6c 64 20 61 6c 77 |, you sh|ould alw|
|00000c20| 61 79 73 20 63 6c 6f 73 | 65 20 74 68 65 20 70 6f |ays clos|e the po|
|00000c30| 72 74 20 62 79 20 63 61 | 6c 6c 69 6e 67 20 43 6c |rt by ca|lling Cl|
|00000c40| 6f 73 65 50 6f 72 74 20 | 6f 72 20 43 6c 6f 73 65 |osePort |or Close|
|00000c50| 43 50 6f 72 74 20 62 65 | 66 6f 72 65 20 63 61 6c |CPort be|fore cal|
|00000c60| 6c 69 6e 67 20 44 69 73 | 70 6f 73 50 74 72 20 6f |ling Dis|posPtr o|
|00000c70| 6e 20 74 68 65 20 70 6f | 72 74 20 6f 72 20 79 6f |n the po|rt or yo|
|00000c80| 75 20 77 69 6c 6c 20 6f | 72 70 68 61 6e 20 68 61 |u will o|rphan ha|
|00000c90| 6e 64 6c 65 73 20 28 76 | 69 73 52 67 6e 2c 20 63 |ndles (v|isRgn, c|
|00000ca0| 6c 69 70 52 67 6e 20 61 | 6e 64 20 6d 6f 72 65 29 |lipRgn a|nd more)|
|00000cb0| 2e 0d 46 75 72 74 68 65 | 72 20 52 65 66 65 72 65 |..Furthe|r Refere|
|00000cc0| 6e 63 65 3a 0d a5 09 51 | 75 69 63 6b 44 72 61 77 |nce:...Q|uickDraw|
|00000cd0| 0d a5 09 54 68 65 20 4d | 65 6d 6f 72 79 20 4d 61 |...The M|emory Ma|
|00000ce0| 6e 61 67 65 72 0d 4d 45 | 20 33 20 2d 20 4d 61 78 |nager.ME| 3 - Max|
|00000cf0| 41 70 70 6c 5a 6f 6e 65 | 20 61 6e 64 20 4d 6f 76 |ApplZone| and Mov|
|00000d00| 65 48 48 69 20 66 72 6f | 6d 20 41 73 73 65 6d 62 |eHHi fro|m Assemb|
|00000d10| 6c 79 20 4c 61 6e 67 75 | 61 67 65 0d 4d 65 6d 6f |ly Langu|age.Memo|
|00000d20| 72 79 09 4d 2e 4d 45 2e | 4d 61 78 41 70 70 6c 5a |ry.M.ME.|MaxApplZ|
|00000d30| 6f 6e 65 26 4d 6f 76 65 | 48 48 69 41 53 4d 0d 52 |one&Move|HHiASM.R|
|00000d40| 65 76 69 73 65 64 20 62 | 79 3a 09 09 4d 61 72 63 |evised b|y:..Marc|
|00000d50| 68 20 31 39 38 38 0d 57 | 72 69 74 74 65 6e 20 62 |h 1988.W|ritten b|
|00000d60| 79 3a 09 42 72 79 61 6e | 20 22 42 6f 62 22 20 4a |y:.Bryan| "Bob" J|
|00000d70| 6f 68 6e 73 6f 6e 09 4a | 61 6e 75 61 72 79 20 31 |ohnson.J|anuary 1|
|00000d80| 39 38 37 0d 57 68 65 6e | 20 63 61 6c 6c 69 6e 67 |987.When| calling|
|00000d90| 20 4d 61 78 41 70 70 6c | 5a 6f 6e 65 20 61 6e 64 | MaxAppl|Zone and|
|00000da0| 20 4d 6f 76 65 48 48 69 | 20 66 72 6f 6d 20 61 73 | MoveHHi| from as|
|00000db0| 73 65 6d 62 6c 79 20 6c | 61 6e 67 75 61 67 65 2c |sembly l|anguage,|
|00000dc0| 20 62 65 20 73 75 72 65 | 20 74 6f 20 67 65 74 20 | be sure| to get |
|00000dd0| 74 68 65 20 63 6f 72 72 | 65 63 74 20 63 6f 64 65 |the corr|ect code|
|00000de0| 2e 20 0d 4d 61 78 41 70 | 70 6c 5a 6f 6e 65 20 61 |. .MaxAp|plZone a|
|00000df0| 6e 64 20 4d 6f 76 65 48 | 48 69 20 77 65 72 65 20 |nd MoveH|Hi were |
|00000e00| 6d 61 72 6b 65 64 20 5b | 4e 6f 74 20 69 6e 20 52 |marked [|Not in R|
|00000e10| 4f 4d 5d 20 69 6e 20 49 | 6e 73 69 64 65 20 4d 61 |OM] in I|nside Ma|
|00000e20| 63 69 6e 74 6f 73 68 2c | 20 56 6f 6c 75 6d 65 73 |cintosh,| Volumes|
|00000e30| 20 49 2d 49 49 49 20 2e | 20 54 68 65 79 20 61 72 | I-III .| They ar|
|00000e40| 65 20 52 4f 4d 20 63 61 | 6c 6c 73 20 69 6e 20 74 |e ROM ca|lls in t|
|00000e50| 68 65 20 31 32 38 4b 20 | 52 4f 4d 2e 20 53 69 6e |he 128K |ROM. Sin|
|00000e60| 63 65 20 74 68 65 79 20 | 61 72 65 20 6e 6f 74 20 |ce they |are not |
|00000e70| 69 6e 20 74 68 65 20 36 | 34 4b 20 52 4f 4d 2c 20 |in the 6|4K ROM, |
|00000e80| 69 66 20 79 6f 75 20 77 | 61 6e 74 20 79 6f 75 72 |if you w|ant your|
|00000e90| 20 70 72 6f 67 72 61 6d | 20 74 6f 20 77 6f 72 6b | program| to work|
|00000ea0| 20 6f 6e 20 36 34 4b 20 | 52 4f 4d 20 72 6f 75 74 | on 64K |ROM rout|
|00000eb0| 69 6e 65 73 20 69 74 20 | 69 73 20 6e 65 63 65 73 |ines it |is neces|
|00000ec0| 73 61 72 79 20 74 6f 20 | 63 61 6c 6c 20 74 68 65 |sary to |call the|
|00000ed0| 20 72 6f 75 74 69 6e 65 | 73 20 62 79 20 61 20 4a | routine|s by a J|
|00000ee0| 53 52 20 74 6f 20 61 20 | 67 6c 75 65 20 28 6c 69 |SR to a |glue (li|
|00000ef0| 62 72 61 72 79 29 20 72 | 6f 75 74 69 6e 65 20 69 |brary) r|outine i|
|00000f00| 6e 73 74 65 61 64 20 6f | 66 20 75 73 69 6e 67 20 |nstead o|f using |
|00000f10| 74 68 65 20 61 63 74 75 | 61 6c 20 74 72 61 70 20 |the actu|al trap |
|00000f20| 6d 61 63 72 6f 2e 20 54 | 68 65 20 67 6c 75 65 20 |macro. T|he glue |
|00000f30| 63 61 6c 6c 73 20 74 68 | 65 20 52 4f 4d 20 72 6f |calls th|e ROM ro|
|00000f40| 75 74 69 6e 65 73 20 69 | 66 20 74 68 65 79 20 61 |utines i|f they a|
|00000f50| 72 65 20 61 76 61 69 6c | 61 62 6c 65 2c 20 6f 72 |re avail|able, or|
|00000f60| 20 65 78 65 63 75 74 65 | 73 20 69 74 73 20 63 6f | execute|s its co|
|00000f70| 70 79 20 6f 66 20 74 68 | 65 6d 20 28 6c 69 6e 6b |py of th|em (link|
|00000f80| 65 64 20 69 6e 74 6f 20 | 79 6f 75 72 20 70 72 6f |ed into |your pro|
|00000f90| 67 72 61 6d 29 20 69 66 | 20 6e 6f 74 2e 0d 48 6f |gram) if| not..Ho|
|00000fa0| 77 20 74 6f 20 64 6f 20 | 69 74 3a 0d 57 68 65 6e |w to do |it:.When|
|00000fb0| 65 76 65 72 20 79 6f 75 | 20 6e 65 65 64 20 74 6f |ever you| need to|
|00000fc0| 20 75 73 65 20 74 68 65 | 73 65 20 63 61 6c 6c 73 | use the|se calls|
|00000fd0| 2c 20 6a 75 73 74 20 63 | 61 6c 6c 20 74 68 65 20 |, just c|all the |
|00000fe0| 6c 69 62 72 61 72 79 20 | 72 6f 75 74 69 6e 65 2e |library |routine.|
|00000ff0| 20 49 74 20 77 69 6c 6c | 20 63 68 65 63 6b 20 52 | It will| check R|
|00001000| 4f 4d 38 35 20 74 6f 20 | 64 65 74 65 72 6d 69 6e |OM85 to |determin|
|00001010| 65 20 77 68 69 63 68 20 | 52 4f 4d 73 20 61 72 65 |e which |ROMs are|
|00001020| 20 72 75 6e 6e 69 6e 67 | 2c 20 61 6e 64 20 64 6f | running|, and do|
|00001030| 20 74 68 65 20 61 70 70 | 72 6f 70 72 69 61 74 65 | the app|ropriate|
|00001040| 20 74 68 69 6e 67 2e 0d | 46 6f 72 20 4d 44 53 2c | thing..|For MDS,|
|00001050| 20 69 6e 63 6c 75 64 65 | 20 74 68 65 20 4d 65 6d | include| the Mem|
|00001060| 6f 72 79 2e 52 65 6c 20 | 6c 69 62 72 61 72 79 20 |ory.Rel |library |
|00001070| 69 6e 20 79 6f 75 72 20 | 6c 69 6e 6b 20 66 69 6c |in your |link fil|
|00001080| 65 20 61 6e 64 20 75 73 | 65 3a 20 0d 09 58 52 45 |e and us|e: ..XRE|
|00001090| 46 20 20 4d 6f 76 65 48 | 48 69 20 20 20 20 3b 20 |F MoveH|Hi ; |
|000010a0| 77 65 20 6e 65 65 64 20 | 74 6f 20 75 73 65 20 74 |we need |to use t|
|000010b0| 68 69 73 20 27 52 4f 4d | 27 20 72 6f 75 74 69 6e |his 'ROM|' routin|
|000010c0| 65 0d 09 2e 2e 2e 0d 09 | 4a 53 52 20 20 4d 6f 76 |e.......|JSR Mov|
|000010d0| 65 48 48 69 20 20 20 20 | 20 3b 20 6a 75 6d 70 20 |eHHi | ; jump |
|000010e0| 74 6f 20 74 68 65 20 67 | 6c 75 65 20 72 6f 75 74 |to the g|lue rout|
|000010f0| 69 6e 65 20 74 68 61 74 | 20 77 69 6c 6c 20 63 68 |ine that| will ch|
|00001100| 65 63 6b 20 52 4f 4d 38 | 35 20 66 6f 72 20 75 73 |eck ROM8|5 for us|
|00001110| 0d 46 6f 72 20 4d 50 57 | 20 6c 69 6e 6b 20 77 69 |.For MPW| link wi|
|00001120| 74 68 20 49 6e 74 65 72 | 66 61 63 65 2e 6f 20 61 |th Inter|face.o a|
|00001130| 6e 64 20 75 73 65 3a 0d | 09 49 4d 50 4f 52 54 20 |nd use:.|.IMPORT |
|00001140| 20 4d 6f 76 65 48 48 69 | 20 20 20 3b 20 77 65 20 | MoveHHi| ; we |
|00001150| 6e 65 65 64 20 74 6f 20 | 75 73 65 20 74 68 69 73 |need to |use this|
|00001160| 0d 09 2e 2e 2e 0d 09 4a | 53 52 20 20 4d 6f 76 65 |.......J|SR Move|
|00001170| 48 48 69 20 20 20 20 20 | 20 3b 20 6a 75 6d 70 20 |HHi | ; jump |
|00001180| 74 6f 20 74 68 65 20 67 | 6c 75 65 20 72 6f 75 74 |to the g|lue rout|
|00001190| 69 6e 65 20 74 68 61 74 | 20 77 69 6c 6c 20 63 68 |ine that| will ch|
|000011a0| 65 63 6b 20 52 4f 4d 38 | 35 20 66 6f 72 20 75 73 |eck ROM8|5 for us|
|000011b0| 0d 41 76 6f 69 64 20 63 | 61 6c 6c 69 6e 67 20 5f |.Avoid c|alling _|
|000011c0| 4d 61 78 41 70 70 6c 5a | 6f 6e 65 20 6f 72 20 5f |MaxApplZ|one or _|
|000011d0| 4d 6f 76 65 48 48 69 20 | 64 69 72 65 63 74 6c 79 |MoveHHi |directly|
|000011e0| 20 69 66 20 79 6f 75 20 | 77 61 6e 74 20 79 6f 75 | if you |want you|
|000011f0| 72 20 73 6f 66 74 77 61 | 72 65 20 74 6f 20 77 6f |r softwa|re to wo|
|00001200| 72 6b 20 6f 6e 20 74 68 | 65 20 36 34 4b 20 52 4f |rk on th|e 64K RO|
|00001210| 4d 73 2c 20 73 69 6e 63 | 65 20 74 68 61 74 20 77 |Ms, sinc|e that w|
|00001220| 69 6c 6c 20 61 73 73 65 | 6d 62 6c 65 20 74 6f 20 |ill asse|mble to |
|00001230| 61 6e 20 61 63 74 75 61 | 6c 20 74 72 61 70 2c 20 |an actua|l trap, |
|00001240| 6e 6f 74 20 74 6f 20 61 | 20 4a 53 52 20 74 6f 20 |not to a| JSR to |
|00001250| 74 68 65 20 6c 69 62 72 | 61 72 79 2e 0d 49 66 20 |the libr|ary..If |
|00001260| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 20 69 73 20 |your pro|gram is |
|00001270| 67 6f 69 6e 67 20 74 6f | 20 62 65 20 72 75 6e 20 |going to| be run |
|00001280| 6f 6e 6c 79 20 6f 6e 20 | 6d 61 63 68 69 6e 65 73 |only on |machines|
|00001290| 20 77 69 74 68 20 74 68 | 65 20 31 32 38 4b 20 52 | with th|e 128K R|
|000012a0| 4f 4d 20 6f 72 20 6e 65 | 77 65 72 2c 20 79 6f 75 |OM or ne|wer, you|
|000012b0| 20 63 61 6e 20 63 61 6c | 6c 20 74 68 65 20 74 72 | can cal|l the tr|
|000012c0| 61 70 73 20 64 69 72 65 | 63 74 6c 79 2e 20 42 65 |aps dire|ctly. Be|
|000012d0| 20 73 75 72 65 20 74 6f | 20 63 68 65 63 6b 20 66 | sure to| check f|
|000012e0| 6f 72 20 74 68 65 20 36 | 34 4b 20 52 4f 4d 73 2c |or the 6|4K ROMs,|
|000012f0| 20 61 6e 64 20 72 65 70 | 6f 72 74 20 61 6e 20 65 | and rep|ort an e|
|00001300| 72 72 6f 72 20 74 6f 20 | 74 68 65 20 75 73 65 72 |rror to |the user|
|00001310| 2e 20 59 6f 75 20 63 61 | 6e 20 63 68 65 63 6b 20 |. You ca|n check |
|00001320| 66 6f 72 20 6f 6c 64 20 | 52 4f 4d 73 20 75 73 69 |for old |ROMs usi|
|00001330| 6e 67 20 74 68 65 20 53 | 79 73 45 6e 76 69 72 6f |ng the S|ysEnviro|
|00001340| 6e 73 20 74 72 61 70 20 | 61 73 20 64 65 73 63 72 |ns trap |as descr|
|00001350| 69 62 65 64 20 69 6e 20 | 54 65 63 68 6e 69 63 61 |ibed in |Technica|
|00001360| 6c 20 4e 6f 74 65 20 23 | 31 32 39 2e 0d 46 75 72 |l Note #|129..Fur|
|00001370| 74 68 65 72 20 52 65 66 | 65 72 65 6e 63 65 3a 0d |ther Ref|erence:.|
|00001380| a5 09 55 73 69 6e 67 20 | 41 73 73 65 6d 62 6c 79 |..Using |Assembly|
|00001390| 20 4c 61 6e 67 75 61 67 | 65 0d a5 09 54 68 65 20 | Languag|e...The |
|000013a0| 4d 65 6d 6f 72 79 20 4d | 61 6e 61 67 65 72 0d a5 |Memory M|anager..|
|000013b0| 09 54 65 63 68 6e 69 63 | 61 6c 20 4e 6f 74 65 20 |.Technic|al Note |
|000013c0| 4d 2e 46 4c 2e 53 79 73 | 45 6e 76 69 72 6f 6e 73 |M.FL.Sys|Environs|
|000013d0| 20 d1 0d 09 09 47 65 73 | 74 61 6c 74 20 61 6e 64 | ....Ges|talt and|
|000013e0| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 3a 20 61 20 | SysEnvi|rons: a |
|000013f0| 4e 65 76 65 72 20 45 6e | 64 69 6e 67 20 53 74 6f |Never En|ding Sto|
|00001400| 72 79 0d 4e 6f 74 69 63 | 65 3a 20 54 68 65 20 69 |ry.Notic|e: The i|
|00001410| 6e 66 6f 72 6d 61 74 69 | 6f 6e 20 69 6e 20 74 68 |nformati|on in th|
|00001420| 69 73 20 54 65 63 68 6e | 69 63 61 6c 20 4e 6f 74 |is Techn|ical Not|
|00001430| 65 20 63 61 6e 20 6e 6f | 77 20 62 65 20 66 6f 75 |e can no|w be fou|
|00001440| 6e 64 20 69 6e 20 49 6e | 73 69 64 65 20 4d 61 63 |nd in In|side Mac|
|00001450| 69 6e 74 6f 73 68 3a 4d | 65 6d 6f 72 79 20 70 61 |intosh:M|emory pa|
|00001460| 67 65 73 20 31 2d 34 31 | 20 74 68 72 6f 75 67 68 |ges 1-41| through|
|00001470| 20 31 2d 34 32 20 61 6e | 64 20 31 2d 35 31 20 74 | 1-42 an|d 1-51 t|
|00001480| 68 72 6f 75 67 68 20 31 | 2d 35 32 2e 20 20 54 68 |hrough 1|-52. Th|
|00001490| 69 73 20 6e 6f 74 65 20 | 77 69 6c 6c 20 62 65 20 |is note |will be |
|000014a0| 72 65 6d 6f 76 65 64 20 | 66 72 6f 6d 20 74 68 65 |removed |from the|
|000014b0| 20 54 65 63 68 6e 69 63 | 61 6c 20 4e 6f 74 65 20 | Technic|al Note |
|000014c0| 6c 69 62 72 61 72 79 20 | 69 6e 20 74 68 65 20 6e |library |in the n|
|000014d0| 65 61 72 20 66 75 74 75 | 72 65 2e 0d 4d 45 20 34 |ear futu|re..ME 4|
|000014e0| 20 2d 20 4d 6f 72 65 4d | 61 73 74 65 72 73 20 52 | - MoreM|asters R|
|000014f0| 65 76 69 73 69 74 65 64 | 0d 4d 65 6d 6f 72 79 09 |evisited|.Memory.|
|00001500| 4d 2e 4d 45 2e 4d 6f 72 | 65 4d 61 73 74 65 72 73 |M.ME.Mor|eMasters|
|00001510| 0d 52 65 76 69 73 65 64 | 20 62 79 3a 09 09 4d 61 |.Revised| by:..Ma|
|00001520| 72 63 68 20 31 39 38 38 | 0d 57 72 69 74 74 65 6e |rch 1988|.Written|
|00001530| 20 62 79 3a 09 4a 69 6d | 20 46 72 69 65 64 6c 61 | by:.Jim| Friedla|
|00001540| 6e 64 65 72 09 4f 63 74 | 6f 62 65 72 20 31 39 38 |nder.Oct|ober 198|
|00001550| 35 0d 4d 6f 72 65 4d 61 | 73 74 65 72 73 20 73 68 |5.MoreMa|sters sh|
|00001560| 6f 75 6c 64 20 62 65 20 | 63 61 6c 6c 65 64 20 66 |ould be |called f|
|00001570| 72 6f 6d 20 43 4f 44 45 | 20 73 65 67 6d 65 6e 74 |rom CODE| segment|
|00001580| 20 31 2e 20 54 68 65 20 | 6e 75 6d 62 65 72 20 6f | 1. The |number o|
|00001590| 66 20 6d 61 73 74 65 72 | 20 70 6f 69 6e 74 65 72 |f master| pointer|
|000015a0| 73 20 74 68 61 74 20 61 | 20 70 72 6f 67 72 61 6d |s that a| program|
|000015b0| 20 6e 65 65 64 73 20 63 | 61 6e 20 62 65 20 64 65 | needs c|an be de|
|000015c0| 74 65 72 6d 69 6e 65 64 | 20 65 6d 70 69 72 69 63 |termined| empiric|
|000015d0| 61 6c 6c 79 2e 20 4d 6f | 72 65 4d 61 73 74 65 72 |ally. Mo|reMaster|
|000015e0| 73 20 63 61 6e 20 62 65 | 20 74 72 69 63 6b 65 64 |s can be| tricked|
|000015f0| 20 69 6e 74 6f 20 63 72 | 65 61 74 69 6e 67 20 74 | into cr|eating t|
|00001600| 68 65 20 65 78 61 63 74 | 20 6e 75 6d 62 65 72 20 |he exact| number |
|00001610| 6f 66 20 6d 61 73 74 65 | 72 20 70 6f 69 6e 74 65 |of maste|r pointe|
|00001620| 72 73 20 64 65 73 69 72 | 65 64 2e 0d 49 66 20 79 |rs desir|ed..If y|
|00001630| 6f 75 20 61 73 6b 20 4d | 61 63 69 6e 74 6f 73 68 |ou ask M|acintosh|
|00001640| 20 70 72 6f 67 72 61 6d | 6d 65 72 73 20 77 68 65 | program|mers whe|
|00001650| 6e 20 61 6e 64 20 68 6f | 77 20 6d 61 6e 79 20 74 |n and ho|w many t|
|00001660| 69 6d 65 73 20 4d 6f 72 | 65 4d 61 73 74 65 72 73 |imes Mor|eMasters|
|00001670| 20 73 68 6f 75 6c 64 20 | 62 65 20 63 61 6c 6c 65 | should |be calle|
|00001680| 64 2c 20 79 6f 75 20 77 | 69 6c 6c 20 67 65 74 20 |d, you w|ill get |
|00001690| 61 20 76 61 72 69 65 74 | 79 20 6f 66 20 61 6e 73 |a variet|y of ans|
|000016a0| 77 65 72 73 2c 20 72 61 | 6e 67 69 6e 67 20 66 72 |wers, ra|nging fr|
|000016b0| 6f 6d 20 d2 66 6f 75 72 | 20 74 69 6d 65 73 20 69 |om .four| times i|
|000016c0| 6e 20 74 68 65 20 69 6e | 69 74 69 61 6c 69 7a 61 |n the in|itializa|
|000016d0| 74 69 6f 6e 20 73 65 67 | 6d 65 6e 74 d3 20 74 6f |tion seg|ment. to|
|000016e0| 20 d2 6f 6e 63 65 2c 20 | 61 6e 79 77 68 65 72 65 | .once, |anywhere|
|000016f0| 2e d3 20 41 73 20 79 6f | 75 20 6d 69 67 68 74 20 |.. As yo|u might |
|00001700| 73 75 73 70 65 63 74 2c | 20 74 68 65 20 61 6e 73 |suspect,| the ans|
|00001710| 77 65 72 20 69 73 20 73 | 6f 6d 65 77 68 61 74 20 |wer is s|omewhat |
|00001720| 64 69 66 66 65 72 65 6e | 74 20 66 72 6f 6d 20 65 |differen|t from e|
|00001730| 69 74 68 65 72 20 6f 66 | 20 74 68 65 73 65 2e 0d |ither of| these..|
|00001740| 4d 6f 72 65 4d 61 73 74 | 65 72 73 20 61 6c 6c 6f |MoreMast|ers allo|
|00001750| 63 61 74 65 73 20 61 20 | 62 6c 6f 63 6b 20 6f 66 |cates a |block of|
|00001760| 20 6d 61 73 74 65 72 20 | 70 6f 69 6e 74 65 72 73 | master |pointers|
|00001770| 20 69 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | in the |current |
|00001780| 68 65 61 70 20 7a 6f 6e | 65 2e 20 49 6e 20 74 68 |heap zon|e. In th|
|00001790| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 68 65 |e applic|ation he|
|000017a0| 61 70 2c 20 61 20 62 6c | 6f 63 6b 20 6f 66 20 6d |ap, a bl|ock of m|
|000017b0| 61 73 74 65 72 20 70 6f | 69 6e 74 65 72 73 20 63 |aster po|inters c|
|000017c0| 6f 6e 73 69 73 74 73 20 | 6f 66 20 36 34 20 6d 61 |onsists |of 64 ma|
|000017d0| 73 74 65 72 20 70 6f 69 | 6e 74 65 72 73 3b 20 69 |ster poi|nters; i|
|000017e0| 6e 20 74 68 65 20 73 79 | 73 74 65 6d 20 68 65 61 |n the sy|stem hea|
|000017f0| 70 2c 20 61 20 62 6c 6f | 63 6b 20 63 6f 6e 73 69 |p, a blo|ck consi|
|00001800| 73 74 73 20 6f 66 20 33 | 32 20 6d 61 73 74 65 72 |sts of 3|2 master|
|00001810| 20 70 6f 69 6e 74 65 72 | 73 2e 20 53 69 6e 63 65 | pointer|s. Since|
|00001820| 20 6d 61 73 74 65 72 20 | 70 6f 69 6e 74 65 72 20 | master |pointer |
|00001830| 62 6c 6f 63 6b 73 20 61 | 72 65 20 6e 6f 6e 2d 72 |blocks a|re non-r|
|00001840| 65 6c 6f 63 61 74 61 62 | 6c 65 2c 20 77 65 20 77 |elocatab|le, we w|
|00001850| 61 6e 74 20 74 6f 20 62 | 65 20 73 75 72 65 20 74 |ant to b|e sure t|
|00001860| 6f 20 61 6c 6c 6f 63 61 | 74 65 20 74 68 65 6d 20 |o alloca|te them |
|00001870| 65 61 72 6c 79 2e 20 54 | 68 65 20 73 79 73 74 65 |early. T|he syste|
|00001880| 6d 20 77 69 6c 6c 20 61 | 6c 6c 6f 63 61 74 65 20 |m will a|llocate |
|00001890| 6f 6e 65 20 6d 61 73 74 | 65 72 20 70 6f 69 6e 74 |one mast|er point|
|000018a0| 65 72 20 62 6c 6f 63 6b | 20 61 73 20 79 6f 75 72 |er block| as your|
|000018b0| 20 70 72 6f 67 72 61 6d | 20 6c 6f 61 64 73 2e 20 | program| loads. |
|000018c0| 49 74 d5 73 20 74 68 65 | 20 66 69 72 73 74 20 6f |It.s the| first o|
|000018d0| 62 6a 65 63 74 20 69 6e | 20 74 68 65 20 61 70 70 |bject in| the app|
|000018e0| 6c 69 63 61 74 69 6f 6e | 20 68 65 61 70 d1 69 74 |lication| heap.it|
|000018f0| 73 20 73 69 7a 65 20 69 | 73 20 24 31 30 38 20 62 |s size i|s $108 b|
|00001900| 79 74 65 73 2e 20 0d 41 | 20 6c 6f 74 20 6f 66 20 |ytes. .A| lot of |
|00001910| 70 72 6f 67 72 61 6d 6d | 65 72 73 20 63 61 6c 6c |programm|ers call|
|00001920| 20 4d 6f 72 65 4d 61 73 | 74 65 72 73 20 66 72 6f | MoreMas|ters fro|
|00001930| 6d 20 61 6e 20 d2 69 6e | 69 74 69 61 6c 69 7a 61 |m an .in|itializa|
|00001940| 74 69 6f 6e d3 20 73 65 | 67 6d 65 6e 74 2c 20 62 |tion. se|gment, b|
|00001950| 75 74 20 61 73 20 77 65 | 20 73 68 61 6c 6c 20 73 |ut as we| shall s|
|00001960| 65 65 2c 20 74 68 61 74 | d5 73 20 6e 6f 74 20 73 |ee, that|.s not s|
|00001970| 75 63 68 20 61 20 67 6f | 6f 64 20 69 64 65 61 2e |uch a go|od idea.|
|00001980| 20 54 68 65 20 70 72 6f | 62 6c 65 6d 20 6f 63 63 | The pro|blem occ|
|00001990| 75 72 73 20 77 68 65 6e | 20 77 65 20 75 6e 6c 6f |urs when| we unlo|
|000019a0| 61 64 20 6f 75 72 20 d2 | 69 6e 69 74 69 61 6c 69 |ad our .|initiali|
|000019b0| 7a 61 74 69 6f 6e d3 20 | 73 65 67 6d 65 6e 74 20 |zation. |segment |
|000019c0| 61 6e 64 20 69 74 20 67 | 65 74 73 20 70 75 72 67 |and it g|ets purg|
|000019d0| 65 64 20 66 72 6f 6d 20 | 6d 65 6d 6f 72 79 2e 0d |ed from |memory..|
|000019e0| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 64 69 |The foll|owing di|
|000019f0| 61 67 72 61 6d 73 20 6f | 66 20 74 68 65 20 61 70 |agrams o|f the ap|
|00001a00| 70 6c 69 63 61 74 69 6f | 6e 20 68 65 61 70 20 69 |plicatio|n heap i|
|00001a10| 6c 6c 75 73 74 72 61 74 | 65 20 77 68 61 74 20 68 |llustrat|e what h|
|00001a20| 61 70 70 65 6e 73 20 69 | 66 20 77 65 20 63 61 6c |appens i|f we cal|
|00001a30| 6c 20 4d 6f 72 65 4d 61 | 73 74 65 72 73 20 66 72 |l MoreMa|sters fr|
|00001a40| 6f 6d 20 43 4f 44 45 20 | 73 65 67 6d 65 6e 74 20 |om CODE |segment |
|00001a50| 32 20 28 4d 50 42 20 73 | 74 61 6e 64 73 20 66 6f |2 (MPB s|tands fo|
|00001a60| 72 20 4d 61 73 74 65 72 | 20 50 6f 69 6e 74 65 72 |r Master| Pointer|
|00001a70| 20 42 6c 6f 63 6b 29 3a | 0d 4e 6f 74 69 63 65 20 | Block):|.Notice |
|00001a80| 74 68 61 74 20 77 65 20 | 6e 6f 77 20 68 61 76 65 |that we |now have|
|00001a90| 20 73 6f 6d 65 20 68 65 | 61 70 20 66 72 61 67 6d | some he|ap fragm|
|00001aa0| 65 6e 74 61 74 69 6f 6e | d1 6e 6f 74 20 73 65 72 |entation|.not ser|
|00001ab0| 69 6f 75 73 2c 20 62 75 | 74 20 69 74 20 63 61 6e |ious, bu|t it can|
|00001ac0| 20 62 65 20 61 76 6f 69 | 64 65 64 20 62 79 20 6d | be avoi|ded by m|
|00001ad0| 61 6b 69 6e 67 20 61 6c | 6c 20 4d 6f 72 65 4d 61 |aking al|l MoreMa|
|00001ae0| 73 74 65 72 73 20 63 61 | 6c 6c 73 20 69 6e 20 43 |sters ca|lls in C|
|00001af0| 4f 44 45 20 73 65 67 6d | 65 6e 74 20 31 2e 20 42 |ODE segm|ent 1. B|
|00001b00| 65 63 61 75 73 65 20 49 | 6e 69 74 57 69 6e 64 6f |ecause I|nitWindo|
|00001b10| 77 73 20 63 72 65 61 74 | 65 73 20 74 68 65 20 57 |ws creat|es the W|
|00001b20| 69 6e 64 6f 77 20 4d 61 | 6e 61 67 65 72 20 50 6f |indow Ma|nager Po|
|00001b30| 72 74 20 28 57 4d 67 72 | 50 6f 72 74 29 2c 20 69 |rt (WMgr|Port), i|
|00001b40| 74 20 73 68 6f 75 6c 64 | 20 61 6c 73 6f 20 62 65 |t should| also be|
|00001b50| 20 63 61 6c 6c 65 64 20 | 66 72 6f 6d 20 43 4f 44 | called |from COD|
|00001b60| 45 20 73 65 67 6d 65 6e | 74 20 31 2e 20 42 6f 74 |E segmen|t 1. Bot|
|00001b70| 68 20 4d 6f 72 65 4d 61 | 73 74 65 72 73 20 61 6e |h MoreMa|sters an|
|00001b80| 64 20 49 6e 69 74 57 69 | 6e 64 6f 77 73 20 73 68 |d InitWi|ndows sh|
|00001b90| 6f 75 6c 64 20 62 65 20 | 63 61 6c 6c 65 64 20 62 |ould be |called b|
|00001ba0| 65 66 6f 72 65 20 61 6e | 6f 74 68 65 72 20 43 4f |efore an|other CO|
|00001bb0| 44 45 20 73 65 67 6d 65 | 6e 74 20 69 73 20 6c 6f |DE segme|nt is lo|
|00001bc0| 61 64 65 64 2c 20 6f 72 | 20 74 68 65 20 6e 6f 6e |aded, or| the non|
|00001bd0| 2d 72 65 6c 6f 63 61 74 | 61 62 6c 65 20 6f 62 6a |-relocat|able obj|
|00001be0| 65 63 74 73 20 74 68 65 | 79 20 61 6c 6c 6f 63 61 |ects the|y alloca|
|00001bf0| 74 65 20 77 69 6c 6c 20 | 62 65 20 70 75 74 20 61 |te will |be put a|
|00001c00| 62 6f 76 65 20 74 68 65 | 20 43 4f 44 45 20 73 65 |bove the| CODE se|
|00001c10| 67 6d 65 6e 74 20 61 6e | 64 20 79 6f 75 d5 6c 6c |gment an|d you.ll|
|00001c20| 20 67 65 74 20 66 72 61 | 67 6d 65 6e 74 61 74 69 | get fra|gmentati|
|00001c30| 6f 6e 20 77 68 65 6e 20 | 74 68 65 20 43 4f 44 45 |on when |the CODE|
|00001c40| 20 73 65 67 6d 65 6e 74 | 20 69 73 20 70 75 72 67 | segment| is purg|
|00001c50| 65 64 2e 20 49 66 20 79 | 6f 75 20 77 61 6e 74 20 |ed. If y|ou want |
|00001c60| 74 6f 20 63 61 6c 6c 20 | 61 6e 20 69 6e 69 74 69 |to call |an initi|
|00001c70| 61 6c 69 7a 61 74 69 6f | 6e 20 73 65 67 6d 65 6e |alizatio|n segmen|
|00001c80| 74 20 62 65 66 6f 72 65 | 20 63 61 6c 6c 69 6e 67 |t before| calling|
|00001c90| 20 4d 6f 72 65 4d 61 73 | 74 65 72 73 20 61 6e 64 | MoreMas|ters and|
|00001ca0| 20 49 6e 69 74 57 69 6e | 64 6f 77 73 2c 20 6d 61 | InitWin|dows, ma|
|00001cb0| 6b 65 20 73 75 72 65 20 | 74 68 61 74 20 79 6f 75 |ke sure |that you|
|00001cc0| 20 75 6e 6c 6f 61 64 20 | 69 74 20 62 65 66 6f 72 | unload |it befor|
|00001cd0| 65 20 79 6f 75 20 63 61 | 6c 6c 20 65 69 74 68 65 |e you ca|ll eithe|
|00001ce0| 72 20 72 6f 75 74 69 6e | 65 2e 0d 4e 6f 77 20 74 |r routin|e..Now t|
|00001cf0| 68 61 74 20 77 65 20 6b | 6e 6f 77 20 77 68 65 6e |hat we k|now when|
|00001d00| 20 74 6f 20 63 61 6c 6c | 20 4d 6f 72 65 4d 61 73 | to call| MoreMas|
|00001d10| 74 65 72 73 2c 20 68 6f | 77 20 6d 61 6e 79 20 74 |ters, ho|w many t|
|00001d20| 69 6d 65 73 20 64 6f 20 | 77 65 20 63 61 6c 6c 20 |imes do |we call |
|00001d30| 69 74 3f 20 54 68 65 20 | 61 6e 73 77 65 72 20 64 |it? The |answer d|
|00001d40| 65 70 65 6e 64 73 20 6f | 6e 20 79 6f 75 72 20 61 |epends o|n your a|
|00001d50| 70 70 6c 69 63 61 74 69 | 6f 6e 2e 20 49 66 20 79 |pplicati|on. If y|
|00001d60| 6f 75 20 64 6f 6e d5 74 | 20 63 61 6c 6c 20 4d 6f |ou don.t| call Mo|
|00001d70| 72 65 4d 61 73 74 65 72 | 73 20 65 6e 6f 75 67 68 |reMaster|s enough|
|00001d80| 20 74 69 6d 65 73 2c 20 | 74 68 65 20 73 79 73 74 | times, |the syst|
|00001d90| 65 6d 20 77 69 6c 6c 20 | 63 61 6c 6c 20 69 74 20 |em will |call it |
|00001da0| 77 68 65 6e 20 69 74 20 | 6e 65 65 64 73 20 6d 6f |when it |needs mo|
|00001db0| 72 65 20 6d 61 73 74 65 | 72 20 70 6f 69 6e 74 65 |re maste|r pointe|
|00001dc0| 72 73 2e 20 54 68 69 73 | 20 63 61 6e 20 68 61 70 |rs. This| can hap|
|00001dd0| 70 65 6e 20 61 74 20 76 | 65 72 79 20 69 6e 63 6f |pen at v|ery inco|
|00001de0| 6e 76 65 6e 69 65 6e 74 | 20 74 69 6d 65 73 2c 20 |nvenient| times, |
|00001df0| 63 61 75 73 69 6e 67 20 | 68 65 61 70 20 66 72 61 |causing |heap fra|
|00001e00| 67 6d 65 6e 74 61 74 69 | 6f 6e 2e 20 49 66 20 79 |gmentati|on. If y|
|00001e10| 6f 75 20 63 61 6c 6c 20 | 4d 6f 72 65 4d 61 73 74 |ou call |MoreMast|
|00001e20| 65 72 73 20 74 6f 6f 20 | 6f 66 74 65 6e 2c 20 79 |ers too |often, y|
|00001e30| 6f 75 20 63 61 6e 20 62 | 65 20 77 61 73 74 69 6e |ou can b|e wastin|
|00001e40| 67 20 76 61 6c 75 61 62 | 6c 65 20 6d 65 6d 6f 72 |g valuab|le memor|
|00001e50| 79 2e 20 54 68 69 73 20 | 69 73 20 70 72 65 66 65 |y. This |is prefe|
|00001e60| 72 61 62 6c 65 2c 20 68 | 6f 77 65 76 65 72 2c 20 |rable, h|owever, |
|00001e70| 74 6f 20 61 6c 6c 6f 63 | 61 74 69 6e 67 20 74 6f |to alloc|ating to|
|00001e80| 6f 20 66 65 77 20 6d 61 | 73 74 65 72 20 70 6f 69 |o few ma|ster poi|
|00001e90| 6e 74 65 72 20 62 6c 6f | 63 6b 73 21 0d 54 68 65 |nter blo|cks!.The|
|00001ea0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 74 69 6d 65 73 | number |of times|
|00001eb0| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 63 61 6c 6c | you sho|uld call|
|00001ec0| 20 4d 6f 72 65 4d 61 73 | 74 65 72 73 20 63 61 6e | MoreMas|ters can|
|00001ed0| 20 62 65 20 65 6d 70 69 | 72 69 63 61 6c 6c 79 20 | be empi|rically |
|00001ee0| 64 65 74 65 72 6d 69 6e | 65 64 2e 20 4f 6e 63 65 |determin|ed. Once|
|00001ef0| 20 79 6f 75 72 20 61 70 | 70 6c 69 63 61 74 69 6f | your ap|plicatio|
|00001f00| 6e 20 69 73 20 61 6c 6d | 6f 73 74 20 66 69 6e 69 |n is alm|ost fini|
|00001f10| 73 68 65 64 2c 20 72 65 | 6d 6f 76 65 20 61 6c 6c |shed, re|move all|
|00001f20| 20 4d 6f 72 65 4d 61 73 | 74 65 72 73 20 63 61 6c | MoreMas|ters cal|
|00001f30| 6c 73 2e 20 45 78 65 72 | 63 69 73 65 20 79 6f 75 |ls. Exer|cise you|
|00001f40| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 61 73 |r applic|ation as|
|00001f50| 20 63 6f 6d 70 6c 65 74 | 65 6c 79 20 61 73 20 70 | complet|ely as p|
|00001f60| 6f 73 73 69 62 6c 65 2c | 20 6f 70 65 6e 69 6e 67 |ossible,| opening|
|00001f70| 20 77 69 6e 64 6f 77 73 | 2c 20 75 73 69 6e 67 20 | windows|, using |
|00001f80| 68 61 6e 64 6c 65 73 2c | 20 6f 70 65 6e 69 6e 67 |handles,| opening|
|00001f90| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 69 65 | desk ac|cessorie|
|00001fa0| 73 2c 20 65 74 63 2e 20 | 59 6f 75 20 63 61 6e 20 |s, etc. |You can |
|00001fb0| 74 68 65 6e 20 67 6f 20 | 69 6e 20 77 69 74 68 20 |then go |in with |
|00001fc0| 61 20 64 65 62 75 67 67 | 65 72 20 61 6e 64 20 73 |a debugg|er and s|
|00001fd0| 65 65 20 68 6f 77 20 6d | 61 6e 79 20 74 69 6d 65 |ee how m|any time|
|00001fe0| 73 20 74 68 65 20 73 79 | 73 74 65 6d 20 63 61 6c |s the sy|stem cal|
|00001ff0| 6c 65 64 20 4d 6f 72 65 | 4d 61 73 74 65 72 73 2e |led More|Masters.|
|00002000| 20 59 6f 75 20 64 6f 20 | 74 68 61 74 20 62 79 20 | You do |that by |
|00002010| 63 6f 75 6e 74 69 6e 67 | 20 74 68 65 20 6e 6f 6e |counting| the non|
|00002020| 2d 72 65 6c 6f 63 61 74 | 61 62 6c 65 73 20 6f 66 |-relocat|ables of|
|00002030| 20 73 69 7a 65 20 24 31 | 30 38 2e 20 44 75 65 20 | size $1|08. Due |
|00002040| 74 6f 20 4d 65 6d 6f 72 | 79 20 4d 61 6e 61 67 65 |to Memor|y Manage|
|00002050| 72 20 73 69 7a 65 20 63 | 6f 72 72 65 63 74 69 6f |r size c|orrectio|
|00002060| 6e 2c 20 74 68 65 20 6d | 61 73 74 65 72 20 70 6f |n, the m|aster po|
|00002070| 69 6e 74 65 72 20 62 6c | 6f 63 6b 73 20 63 61 6e |inter bl|ocks can|
|00002080| 20 61 6c 73 6f 20 68 61 | 76 65 20 61 20 73 69 7a | also ha|ve a siz|
|00002090| 65 20 6f 66 20 24 31 30 | 43 20 6f 72 20 24 31 31 |e of $10|C or $11|
|000020a0| 30 20 62 79 74 65 73 2e | 20 59 6f 75 20 73 68 6f |0 bytes.| You sho|
|000020b0| 75 6c 64 20 67 69 76 65 | 20 79 6f 75 72 73 65 6c |uld give| yoursel|
|000020c0| 66 20 61 62 6f 75 74 20 | 32 30 25 20 6c 65 65 77 |f about |20% leew|
|000020d0| 61 79 20 d1 20 74 68 61 | 74 20 69 73 2c 20 69 66 |ay . tha|t is, if|
|000020e0| 20 74 68 65 20 73 79 73 | 74 65 6d 20 63 61 6c 6c | the sys|tem call|
|000020f0| 65 64 20 4d 6f 72 65 4d | 61 73 74 65 72 73 20 31 |ed MoreM|asters 1|
|00002100| 30 20 74 69 6d 65 73 20 | 66 6f 72 20 79 6f 75 2c |0 times |for you,|
|00002110| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 63 61 6c 6c | you sho|uld call|
|00002120| 20 69 74 20 31 32 20 74 | 69 6d 65 73 2e 20 49 66 | it 12 t|imes. If|
|00002130| 20 79 6f 75 d5 72 65 20 | 6d 6f 72 65 20 63 61 75 | you.re |more cau|
|00002140| 74 69 6f 75 73 2c 20 79 | 6f 75 20 6d 69 67 68 74 |tious, y|ou might|
|00002150| 20 77 61 6e 74 20 74 6f | 20 63 61 6c 6c 20 4d 6f | want to| call Mo|
|00002160| 72 65 4d 61 73 74 65 72 | 73 20 31 35 20 74 69 6d |reMaster|s 15 tim|
|00002170| 65 73 2e 0d 41 6e 6f 74 | 68 65 72 20 74 65 63 68 |es..Anot|her tech|
|00002180| 6e 69 71 75 65 20 74 68 | 61 74 20 63 61 6e 20 73 |nique th|at can s|
|00002190| 61 76 65 20 74 69 6d 65 | 20 61 74 20 69 6e 69 74 |ave time| at init|
|000021a0| 69 61 6c 69 7a 61 74 69 | 6f 6e 20 69 73 20 74 6f |ializati|on is to|
|000021b0| 20 63 61 6c 63 75 6c 61 | 74 65 20 74 68 65 20 6e | calcula|te the n|
|000021c0| 75 6d 62 65 72 20 6f 66 | 20 6d 61 73 74 65 72 20 |umber of| master |
|000021d0| 70 6f 69 6e 74 65 72 73 | 20 79 6f 75 20 77 69 6c |pointers| you wil|
|000021e0| 6c 20 6e 65 65 64 2c 20 | 74 68 65 6e 20 73 65 74 |l need, |then set|
|000021f0| 20 74 68 65 20 4d 6f 72 | 65 4d 61 73 74 20 66 69 | the Mor|eMast fi|
|00002200| 6c 65 73 20 6f 66 20 74 | 68 65 20 68 65 61 70 20 |les of t|he heap |
|00002210| 7a 6f 6e 65 20 68 65 61 | 64 65 72 20 74 6f 20 74 |zone hea|der to t|
|00002220| 68 61 74 20 6e 75 6d 62 | 65 72 2c 20 61 6e 64 20 |hat numb|er, and |
|00002230| 74 68 65 6e 20 63 61 6c | 6c 20 4d 6f 72 65 4d 61 |then cal|l MoreMa|
|00002240| 73 74 65 72 73 20 6f 6e | 63 65 3a 0d 09 50 52 4f |sters on|ce:..PRO|
|00002250| 43 45 44 55 52 45 20 4d | 79 4d 6f 72 65 4d 61 73 |CEDURE M|yMoreMas|
|00002260| 74 65 72 73 28 6e 75 6d | 4d 61 73 74 50 74 72 73 |ters(num|MastPtrs|
|00002270| 20 3a 20 49 4e 54 45 47 | 45 52 29 3b 0d 09 56 41 | : INTEG|ER);..VA|
|00002280| 52 0d 09 20 20 20 6f 6c | 64 4d 6f 72 65 4d 61 73 |R.. ol|dMoreMas|
|00002290| 74 20 3a 20 49 4e 54 45 | 47 45 52 3b 09 09 7b 73 |t : INTE|GER;..{s|
|000022a0| 61 76 65 64 20 76 61 6c | 75 65 20 6f 66 20 4d 6f |aved val|ue of Mo|
|000022b0| 72 65 4d 61 73 74 7d 0d | 09 20 20 20 7a 6f 6e 65 |reMast}.|. zone|
|000022c0| 20 20 20 20 20 20 20 20 | 3a 20 54 48 7a 3b 09 09 | |: THz;..|
|000022d0| 7b 68 65 61 70 20 7a 6f | 6e 65 7d 0d 09 42 45 47 |{heap zo|ne}..BEG|
|000022e0| 49 4e 0d 20 20 09 20 20 | 20 7a 6f 6e 65 20 3a 3d |IN. . | zone :=|
|000022f0| 20 47 65 74 5a 6f 6e 65 | 3b 09 09 09 7b 67 65 74 | GetZone|;...{get|
|00002300| 20 74 68 65 20 68 65 61 | 70 20 7a 6f 6e 65 7d 0d | the hea|p zone}.|
|00002310| 09 20 20 20 57 49 54 48 | 20 7a 6f 6e 65 5e 20 44 |. WITH| zone^ D|
|00002320| 4f 20 42 45 47 49 4e 0d | 09 20 20 20 20 20 20 6f |O BEGIN.|. o|
|00002330| 6c 64 4d 6f 72 65 4d 61 | 73 74 20 3a 3d 20 4d 6f |ldMoreMa|st := Mo|
|00002340| 72 65 4d 61 73 74 3b 09 | 7b 67 65 74 20 74 68 65 |reMast;.|{get the|
|00002350| 20 6f 6c 64 20 76 61 6c | 75 65 20 6f 66 20 4d 6f | old val|ue of Mo|
|00002360| 72 65 4d 61 73 74 7d 0d | 09 20 20 20 20 20 4d 6f |reMast}.|. Mo|
|00002370| 72 65 4d 61 73 74 20 3a | 3d 20 6e 75 6d 4d 61 73 |reMast :|= numMas|
|00002380| 74 50 74 72 73 3b 09 7b | 70 75 74 20 76 61 6c 75 |tPtrs;.{|put valu|
|00002390| 65 20 77 65 20 77 61 6e | 74 20 69 6e 20 7a 6f 6e |e we wan|t in zon|
|000023a0| 65 20 68 65 61 64 65 72 | 7d 0d 09 20 20 20 20 20 |e header|}.. |
|000023b0| 20 4d 6f 72 65 4d 61 73 | 74 65 72 73 3b 20 20 20 | MoreMas|ters; |
|000023c0| 20 20 20 20 20 20 20 20 | 20 20 09 7b 61 6c 6c 6f | | .{allo|
|000023d0| 63 61 74 65 20 74 68 65 | 20 6d 61 73 74 65 72 20 |cate the| master |
|000023e0| 70 6f 69 6e 74 65 72 73 | 7d 0d 09 20 20 20 20 20 |pointers|}.. |
|000023f0| 20 4d 6f 72 65 4d 61 73 | 74 20 3a 3d 20 6f 6c 64 | MoreMas|t := old|
|00002400| 4d 6f 72 65 4d 61 73 74 | 3b 09 7b 72 65 73 74 6f |MoreMast|;.{resto|
|00002410| 72 65 20 74 68 65 20 6f | 6c 64 20 76 61 6c 75 65 |re the o|ld value|
|00002420| 20 6f 66 20 4d 6f 72 65 | 4d 61 73 74 7d 0d 09 20 | of More|Mast}.. |
|00002430| 20 20 45 4e 44 3b 0d 09 | 45 4e 44 3b 0d 49 6e 20 | END;..|END;.In |
|00002440| 4d 50 57 20 43 3a 0d 09 | 76 6f 69 64 20 4d 79 4d |MPW C:..|void MyM|
|00002450| 6f 72 65 4d 61 73 74 65 | 72 73 28 6e 75 6d 4d 61 |oreMaste|rs(numMa|
|00002460| 73 74 50 74 72 73 29 0d | 09 73 68 6f 72 74 20 6e |stPtrs).|.short n|
|00002470| 75 6d 4d 61 73 74 50 74 | 72 73 3b 0d 09 7b 20 2f |umMastPt|rs;..{ /|
|00002480| 2a 20 4d 79 4d 6f 72 65 | 4d 61 73 74 65 72 73 20 |* MyMore|Masters |
|00002490| 2a 2f 0d 09 20 20 20 73 | 68 6f 72 74 20 20 20 20 |*/.. s|hort |
|000024a0| 20 6f 6c 64 4d 6f 72 65 | 4d 61 73 74 3b 20 20 20 | oldMore|Mast; |
|000024b0| 20 20 20 20 20 20 20 2f | 2a 20 73 61 76 65 64 20 | /|* saved |
|000024c0| 76 61 6c 75 65 20 6f 66 | 20 4d 6f 72 65 4d 61 73 |value of| MoreMas|
|000024d0| 74 2a 2f 0d 09 20 20 20 | 54 48 7a 20 20 20 20 20 |t*/.. |THz |
|000024e0| 20 20 6f 5a 6f 6e 65 3b | 20 20 20 20 20 20 20 20 | oZone;| |
|000024f0| 20 20 20 20 20 20 20 20 | 2f 2a 20 68 65 61 70 20 | |/* heap |
|00002500| 7a 6f 6e 65 2a 2f 0d 09 | 20 20 20 6f 5a 6f 6e 65 |zone*/..| oZone|
|00002510| 20 3d 20 47 65 74 5a 6f | 6e 65 28 29 3b 20 20 20 | = GetZo|ne(); |
|00002520| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 67 65 | | /* ge|
|00002530| 74 20 74 68 65 20 68 65 | 61 70 20 7a 6f 6e 65 2a |t the he|ap zone*|
|00002540| 2f 0d 09 20 20 20 6f 6c | 64 4d 6f 72 65 4d 61 73 |/.. ol|dMoreMas|
|00002550| 74 20 3d 20 6f 5a 6f 6e | 65 2d 3e 6d 6f 72 65 4d |t = oZon|e->moreM|
|00002560| 61 73 74 3b 20 20 2f 2a | 20 67 65 74 20 74 68 65 |ast; /*| get the|
|00002570| 20 6f 6c 64 20 76 61 6c | 75 65 20 6f 66 20 4d 6f | old val|ue of Mo|
|00002580| 72 65 4d 61 73 74 2a 2f | 0d 09 20 20 20 6f 5a 6f |reMast*/|.. oZo|
|00002590| 6e 65 2d 3e 6d 6f 72 65 | 4d 61 73 74 20 3d 20 6e |ne->more|Mast = n|
|000025a0| 75 6d 4d 61 73 74 50 74 | 72 73 3b 20 20 2f 2a 20 |umMastPt|rs; /* |
|000025b0| 70 75 74 20 74 68 65 20 | 76 61 6c 75 65 20 77 65 |put the |value we|
|000025c0| 20 77 61 6e 74 20 69 6e | 20 74 68 65 0d 09 20 20 | want in| the.. |
|000025d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000025e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000025f0| 20 20 20 20 7a 6f 6e 65 | 20 68 65 61 64 65 72 20 | zone| header |
|00002600| 2a 2f 0d 09 20 20 20 4d | 6f 72 65 4d 61 73 74 65 |*/.. M|oreMaste|
|00002610| 72 73 28 29 3b 20 20 20 | 20 20 20 20 20 20 20 20 |rs(); | |
|00002620| 20 20 20 20 20 20 20 2f | 2a 61 6c 6c 6f 63 61 74 | /|*allocat|
|00002630| 65 20 74 68 65 20 6d 61 | 73 74 65 72 20 70 6f 69 |e the ma|ster poi|
|00002640| 6e 74 65 72 73 2a 2f 0d | 09 20 20 20 6f 5a 6f 6e |nters*/.|. oZon|
|00002650| 65 2d 3e 6d 6f 72 65 4d | 61 73 74 20 3d 20 6f 6c |e->moreM|ast = ol|
|00002660| 64 4d 6f 72 65 4d 61 73 | 74 3b 20 20 2f 2a 72 65 |dMoreMas|t; /*re|
|00002670| 73 74 6f 72 65 20 74 68 | 65 20 6f 6c 64 20 76 61 |store th|e old va|
|00002680| 6c 75 65 20 6f 66 20 4d | 6f 72 65 4d 61 73 74 2a |lue of M|oreMast*|
|00002690| 2f 0d 09 7d 20 2f 2a 20 | 4d 79 4d 6f 72 65 4d 61 |/..} /* |MyMoreMa|
|000026a0| 73 74 65 72 73 20 2a 2f | 0d 46 75 72 74 68 65 72 |sters */|.Further|
|000026b0| 20 52 65 66 65 72 65 6e | 63 65 3a 0d a5 09 54 68 | Referen|ce:...Th|
|000026c0| 65 20 4d 65 6d 6f 72 79 | 20 4d 61 6e 61 67 65 72 |e Memory| Manager|
|000026d0| 0d 4e 6f 74 69 63 65 3a | 20 54 68 65 20 69 6e 66 |.Notice:| The inf|
|000026e0| 6f 72 6d 61 74 69 6f 6e | 20 69 6e 20 74 68 69 73 |ormation| in this|
|000026f0| 20 54 65 63 68 6e 69 63 | 61 6c 20 4e 6f 74 65 20 | Technic|al Note |
|00002700| 63 61 6e 20 6e 6f 77 20 | 62 65 20 66 6f 75 6e 64 |can now |be found|
|00002710| 20 69 6e 20 49 6e 73 69 | 64 65 20 4d 61 63 69 6e | in Insi|de Macin|
|00002720| 74 6f 73 68 3a 4d 65 6d | 6f 72 79 20 70 61 67 65 |tosh:Mem|ory page|
|00002730| 73 20 31 2d 37 31 2e 20 | 20 54 68 69 73 20 6e 6f |s 1-71. | This no|
|00002740| 74 65 20 77 69 6c 6c 20 | 62 65 20 72 65 6d 6f 76 |te will |be remov|
|00002750| 65 64 20 66 72 6f 6d 20 | 74 68 65 20 54 65 63 68 |ed from |the Tech|
|00002760| 6e 69 63 61 6c 20 4e 6f | 74 65 20 6c 69 62 72 61 |nical No|te libra|
|00002770| 72 79 20 69 6e 20 74 68 | 65 20 6e 65 61 72 20 66 |ry in th|e near f|
|00002780| 75 74 75 72 65 2e 0d 4d | 45 20 35 20 2d 20 4d 6f |uture..M|E 5 - Mo|
|00002790| 76 65 48 48 69 20 61 6e | 64 20 53 65 74 52 65 73 |veHHi an|d SetRes|
|000027a0| 50 75 72 67 65 0d 4d 65 | 6d 6f 72 79 09 4d 2e 4d |Purge.Me|mory.M.M|
|000027b0| 45 2e 4d 6f 76 65 48 48 | 69 53 65 74 52 65 73 50 |E.MoveHH|iSetResP|
|000027c0| 75 72 67 65 0d 52 65 76 | 69 73 65 64 20 62 79 3a |urge.Rev|ised by:|
|000027d0| 09 09 4d 61 72 63 68 20 | 31 39 38 38 0d 57 72 69 |..March |1988.Wri|
|000027e0| 74 74 65 6e 20 62 79 3a | 09 4a 69 6d 20 46 72 69 |tten by:|.Jim Fri|
|000027f0| 65 64 6c 61 6e 64 65 72 | 09 4d 61 72 63 68 20 31 |edlander|.March 1|
|00002800| 39 38 37 0d 53 65 74 52 | 65 73 50 75 72 67 65 28 |987.SetR|esPurge(|
|00002810| 54 52 55 45 29 20 69 73 | 20 63 61 6c 6c 65 64 20 |TRUE) is| called |
|00002820| 74 6f 20 6d 61 6b 65 20 | 74 68 65 20 4d 65 6d 6f |to make |the Memo|
|00002830| 72 79 20 4d 61 6e 61 67 | 65 72 20 63 61 6c 6c 20 |ry Manag|er call |
|00002840| 74 68 65 20 52 65 73 6f | 75 72 63 65 20 4d 61 6e |the Reso|urce Man|
|00002850| 61 67 65 72 20 62 65 66 | 6f 72 65 20 70 75 72 67 |ager bef|ore purg|
|00002860| 69 6e 67 20 61 20 62 6c | 6f 63 6b 20 73 70 65 63 |ing a bl|ock spec|
|00002870| 69 66 69 65 64 20 62 79 | 20 61 20 68 61 6e 64 6c |ified by| a handl|
|00002880| 65 2e 20 49 66 20 74 68 | 65 20 68 61 6e 64 6c 65 |e. If th|e handle|
|00002890| 20 69 73 20 61 20 68 61 | 6e 64 6c 65 20 74 6f 20 | is a ha|ndle to |
|000028a0| 61 20 72 65 73 6f 75 72 | 63 65 2c 20 61 6e 64 20 |a resour|ce, and |
|000028b0| 69 74 73 20 72 65 73 43 | 68 61 6e 67 65 64 20 62 |its resC|hanged b|
|000028c0| 69 74 20 69 73 20 73 65 | 74 2c 20 74 68 65 20 72 |it is se|t, the r|
|000028d0| 65 73 6f 75 72 63 65 20 | 64 61 74 61 20 77 69 6c |esource |data wil|
|000028e0| 6c 20 62 65 20 77 72 69 | 74 74 65 6e 20 6f 75 74 |l be wri|tten out|
|000028f0| 20 28 75 73 69 6e 67 20 | 57 72 69 74 65 52 65 73 | (using |WriteRes|
|00002900| 6f 75 72 63 65 29 2e 0d | 57 68 65 6e 20 4d 6f 76 |ource)..|When Mov|
|00002910| 65 48 48 69 20 69 73 20 | 63 61 6c 6c 65 64 2c 20 |eHHi is |called, |
|00002920| 65 76 65 6e 20 74 68 6f | 75 67 68 20 74 68 65 20 |even tho|ugh the |
|00002930| 68 61 6e 64 6c 65 d5 73 | 20 62 6c 6f 63 6b 20 69 |handle.s| block i|
|00002940| 73 20 6e 6f 74 20 61 63 | 74 75 61 6c 6c 79 20 62 |s not ac|tually b|
|00002950| 65 69 6e 67 20 70 75 72 | 67 65 64 2c 20 74 68 65 |eing pur|ged, the|
|00002960| 20 72 65 73 6f 75 72 63 | 65 20 64 61 74 61 20 73 | resourc|e data s|
|00002970| 70 65 63 69 66 69 65 64 | 20 62 79 20 74 68 65 20 |pecified| by the |
|00002980| 68 61 6e 64 6c 65 20 77 | 69 6c 6c 20 62 65 20 77 |handle w|ill be w|
|00002990| 72 69 74 74 65 6e 20 6f | 75 74 2e 20 41 6e 20 61 |ritten o|ut. An a|
|000029a0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 63 61 6e 20 70 |pplicati|on can p|
|000029b0| 72 65 76 65 6e 74 20 74 | 68 69 73 20 62 79 20 63 |revent t|his by c|
|000029c0| 61 6c 6c 69 6e 67 20 53 | 65 74 52 65 73 50 75 72 |alling S|etResPur|
|000029d0| 67 65 28 46 41 4c 53 45 | 29 20 62 65 66 6f 72 65 |ge(FALSE|) before|
|000029e0| 20 63 61 6c 6c 69 6e 67 | 20 4d 6f 76 65 48 48 69 | calling| MoveHHi|
|000029f0| 20 28 61 6e 64 20 74 68 | 65 6e 20 63 61 6c 6c 69 | (and th|en calli|
|00002a00| 6e 67 20 53 65 74 52 65 | 73 50 75 72 67 65 28 54 |ng SetRe|sPurge(T|
|00002a10| 52 55 45 29 20 61 66 74 | 65 72 20 74 68 65 20 4d |RUE) aft|er the M|
|00002a20| 6f 76 65 48 48 69 20 63 | 61 6c 6c 29 2e 0d 46 75 |oveHHi c|all)..Fu|
|00002a30| 72 74 68 65 72 20 52 65 | 66 65 72 65 6e 63 65 3a |rther Re|ference:|
|00002a40| 0d a5 09 54 68 65 20 4d | 65 6d 6f 72 79 20 4d 61 |...The M|emory Ma|
|00002a50| 6e 61 67 65 72 0d a5 09 | 54 68 65 20 52 65 73 6f |nager...|The Reso|
|00002a60| 75 72 63 65 20 4d 61 6e | 61 67 65 72 0d 4e 6f 74 |urce Man|ager.Not|
|00002a70| 69 63 65 3a 20 54 68 65 | 20 69 6e 66 6f 72 6d 61 |ice: The| informa|
|00002a80| 74 69 6f 6e 20 69 6e 20 | 74 68 69 73 20 54 65 63 |tion in |this Tec|
|00002a90| 68 6e 69 63 61 6c 20 4e | 6f 74 65 20 63 61 6e 20 |hnical N|ote can |
|00002aa0| 6e 6f 77 20 62 65 20 66 | 6f 75 6e 64 20 69 6e 20 |now be f|ound in |
|00002ab0| 49 6e 73 69 64 65 20 4d | 61 63 69 6e 74 6f 73 68 |Inside M|acintosh|
|00002ac0| 3a 4d 65 6d 6f 72 79 20 | 70 61 67 65 73 20 34 2d |:Memory |pages 4-|
|00002ad0| 32 30 20 74 68 72 6f 75 | 67 68 20 34 2d 32 34 20 |20 throu|gh 4-24 |
|00002ae0| 61 6e 64 20 34 2d 32 37 | 2e 20 20 54 68 69 73 20 |and 4-27|. This |
|00002af0| 6e 6f 74 65 20 77 69 6c | 6c 20 62 65 20 72 65 6d |note wil|l be rem|
|00002b00| 6f 76 65 64 20 66 72 6f | 6d 20 74 68 65 20 54 65 |oved fro|m the Te|
|00002b10| 63 68 6e 69 63 61 6c 20 | 4e 6f 74 65 20 6c 69 62 |chnical |Note lib|
|00002b20| 72 61 72 79 20 69 6e 20 | 74 68 65 20 6e 65 61 72 |rary in |the near|
|00002b30| 20 66 75 74 75 72 65 2e | 0d 4d 45 20 36 20 2d 20 | future.|.ME 6 - |
|00002b40| 5f 53 74 72 69 70 41 64 | 64 72 65 73 73 3a 20 20 |_StripAd|dress: |
|00002b50| 54 68 65 20 55 6e 74 6f | 6c 64 20 53 74 6f 72 79 |The Unto|ld Story|
|00002b60| 0d 4d 65 6d 6f 72 79 09 | 4d 2e 4d 45 2e 53 74 72 |.Memory.|M.ME.Str|
|00002b70| 69 70 41 64 64 72 65 73 | 73 0d 52 65 76 69 73 65 |ipAddres|s.Revise|
|00002b80| 64 20 62 79 3a 09 50 61 | 75 6c 20 53 6e 69 76 65 |d by:.Pa|ul Snive|
|00002b90| 6c 79 20 26 20 41 6e 64 | 72 65 77 20 53 68 65 62 |ly & And|rew Sheb|
|00002ba0| 61 6e 6f 77 09 41 75 67 | 75 73 74 20 31 39 39 30 |anow.Aug|ust 1990|
|00002bb0| 0d 57 72 69 74 74 65 6e | 20 62 79 3a 09 41 6e 64 |.Written| by:.And|
|00002bc0| 72 65 77 20 53 68 65 62 | 61 6e 6f 77 09 4f 63 74 |rew Sheb|anow.Oct|
|00002bd0| 6f 62 65 72 20 31 39 38 | 38 0d 49 6e 73 69 64 65 |ober 198|8.Inside|
|00002be0| 20 4d 61 63 69 6e 74 6f | 73 68 2c 20 56 6f 6c 75 | Macinto|sh, Volu|
|00002bf0| 6d 65 20 56 2c 20 54 68 | 65 20 4f 53 20 55 74 69 |me V, Th|e OS Uti|
|00002c00| 6c 69 74 69 65 73 2c 20 | 69 6e 63 6f 72 72 65 63 |lities, |incorrec|
|00002c10| 74 6c 79 20 64 6f 63 75 | 6d 65 6e 74 73 20 74 68 |tly docu|ments th|
|00002c20| 65 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 20 |e _Strip|Address |
|00002c30| 74 72 61 70 3b 20 74 68 | 69 73 20 54 65 63 68 6e |trap; th|is Techn|
|00002c40| 69 63 61 6c 20 4e 6f 74 | 65 20 63 6f 72 72 65 63 |ical Not|e correc|
|00002c50| 74 6c 79 20 64 6f 63 75 | 6d 65 6e 74 73 20 74 68 |tly docu|ments th|
|00002c60| 65 20 74 72 61 70 20 61 | 6e 64 20 67 69 76 65 73 |e trap a|nd gives|
|00002c70| 20 67 75 69 64 65 6c 69 | 6e 65 73 20 66 6f 72 20 | guideli|nes for |
|00002c80| 69 74 73 20 75 73 65 2e | 0d 43 68 61 6e 67 65 73 |its use.|.Changes|
|00002c90| 20 73 69 6e 63 65 20 41 | 70 72 69 6c 20 31 39 39 | since A|pril 199|
|00002ca0| 30 3a 20 20 41 64 64 65 | 64 20 61 20 64 69 73 63 |0: Adde|d a disc|
|00002cb0| 75 73 73 69 6f 6e 20 6f | 66 20 77 68 79 20 74 68 |ussion o|f why th|
|00002cc0| 65 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 20 |e _Strip|Address |
|00002cd0| 74 72 61 70 20 73 68 6f | 75 6c 64 20 62 65 20 75 |trap sho|uld be u|
|00002ce0| 73 65 64 20 75 6e 64 65 | 72 20 63 65 72 74 61 69 |sed unde|r certai|
|00002cf0| 6e 20 63 69 72 63 75 6d | 73 74 61 6e 63 65 73 20 |n circum|stances |
|00002d00| 77 68 65 6e 20 70 61 74 | 63 68 69 6e 67 20 74 72 |when pat|ching tr|
|00002d10| 61 70 73 2e 0d 44 6f 6e | d5 74 20 42 65 6c 69 65 |aps..Don|.t Belie|
|00002d20| 76 65 20 45 76 65 72 79 | 74 68 69 6e 67 20 59 6f |ve Every|thing Yo|
|00002d30| 75 20 52 65 61 64 0d 54 | 68 65 20 5f 53 74 72 69 |u Read.T|he _Stri|
|00002d40| 70 41 64 64 72 65 73 73 | 20 74 72 61 70 20 69 73 |pAddress| trap is|
|00002d50| 20 64 65 73 63 72 69 62 | 65 64 20 69 6e 20 74 68 | describ|ed in th|
|00002d60| 65 20 4f 53 20 55 74 69 | 6c 69 74 69 65 73 20 63 |e OS Uti|lities c|
|00002d70| 68 61 70 74 65 72 20 6f | 66 20 49 6e 73 69 64 65 |hapter o|f Inside|
|00002d80| 20 4d 61 63 69 6e 74 6f | 73 68 2c 20 56 6f 6c 75 | Macinto|sh, Volu|
|00002d90| 6d 65 20 56 20 61 73 3a | 0d 09 46 55 4e 43 54 49 |me V as:|..FUNCTI|
|00002da0| 4f 4e 20 53 74 72 69 70 | 41 64 64 72 65 73 73 28 |ON Strip|Address(|
|00002db0| 74 68 65 41 64 64 72 65 | 73 73 3a 20 4c 4f 4e 47 |theAddre|ss: LONG|
|00002dc0| 49 4e 54 29 3a 20 4c 4f | 4e 47 49 4e 54 3b 0d 49 |INT): LO|NGINT;.I|
|00002dd0| 66 20 74 68 65 20 73 79 | 73 74 65 6d 20 69 73 20 |f the sy|stem is |
|00002de0| 72 75 6e 6e 69 6e 67 20 | 69 6e 20 32 34 2d 62 69 |running |in 24-bi|
|00002df0| 74 20 6d 6f 64 65 2c 20 | 5f 53 74 72 69 70 41 64 |t mode, |_StripAd|
|00002e00| 64 72 65 73 73 20 69 73 | 20 69 64 65 6e 74 69 63 |dress is| identic|
|00002e10| 61 6c 20 69 6e 20 66 75 | 6e 63 74 69 6f 6e 20 74 |al in fu|nction t|
|00002e20| 6f 20 74 68 65 20 67 6c | 6f 62 61 6c 20 76 61 72 |o the gl|obal var|
|00002e30| 69 61 62 6c 65 20 4c 6f | 33 42 79 74 65 73 3a 20 |iable Lo|3Bytes: |
|00002e40| 69 74 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 76 |it retur|ns the v|
|00002e50| 61 6c 75 65 20 6f 66 20 | 74 68 65 20 6c 6f 77 2d |alue of |the low-|
|00002e60| 6f 72 64 65 72 20 74 68 | 72 65 65 20 62 79 74 65 |order th|ree byte|
|00002e70| 73 20 6f 66 20 74 68 65 | 20 61 64 64 72 65 73 73 |s of the| address|
|00002e80| 20 70 61 73 73 65 64 20 | 69 6e 20 74 68 65 41 64 | passed |in theAd|
|00002e90| 64 72 65 73 73 2e 20 20 | 49 66 20 74 68 65 20 73 |dress. |If the s|
|00002ea0| 79 73 74 65 6d 20 69 73 | 20 69 6e 20 33 32 2d 62 |ystem is| in 32-b|
|00002eb0| 69 74 20 6d 6f 64 65 2c | 20 68 6f 77 65 76 65 72 |it mode,| however|
|00002ec0| 2c 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 20 |, _Strip|Address |
|00002ed0| 73 69 6d 70 6c 79 20 70 | 61 73 73 65 73 20 62 61 |simply p|asses ba|
|00002ee0| 63 6b 20 74 68 65 20 61 | 64 64 72 65 73 73 20 75 |ck the a|ddress u|
|00002ef0| 6e 63 68 61 6e 67 65 64 | 2e 0d 54 68 69 73 20 64 |nchanged|..This d|
|00002f00| 65 73 63 72 69 70 74 69 | 6f 6e 20 69 73 20 69 6e |escripti|on is in|
|00002f10| 63 6f 72 72 65 63 74 2c | 20 61 6e 64 20 69 74 20 |correct,| and it |
|00002f20| 69 73 20 6c 6f 63 61 74 | 65 64 20 69 6e 20 74 68 |is locat|ed in th|
|00002f30| 65 20 77 72 6f 6e 67 20 | 63 68 61 70 74 65 72 20 |e wrong |chapter |
|00002f40| 6f 66 20 49 6e 73 69 64 | 65 20 4d 61 63 69 6e 74 |of Insid|e Macint|
|00002f50| 6f 73 68 20 28 69 74 20 | 73 68 6f 75 6c 64 20 62 |osh (it |should b|
|00002f60| 65 20 69 6e 20 74 68 65 | 20 4d 65 6d 6f 72 79 20 |e in the| Memory |
|00002f70| 4d 61 6e 61 67 65 72 20 | 63 68 61 70 74 65 72 29 |Manager |chapter)|
|00002f80| 2e 20 20 54 68 65 20 5f | 53 74 72 69 70 41 64 64 |. The _|StripAdd|
|00002f90| 72 65 73 73 20 74 72 61 | 70 20 6e 6f 77 20 74 61 |ress tra|p now ta|
|00002fa0| 6b 65 73 20 61 20 50 74 | 72 20 61 73 20 61 20 70 |kes a Pt|r as a p|
|00002fb0| 61 72 61 6d 65 74 65 72 | 20 61 6e 64 20 72 65 74 |arameter| and ret|
|00002fc0| 75 72 6e 73 20 61 20 50 | 74 72 3a 0d 09 46 55 4e |urns a P|tr:..FUN|
|00002fd0| 43 54 49 4f 4e 20 53 74 | 72 69 70 41 64 64 72 65 |CTION St|ripAddre|
|00002fe0| 73 73 28 74 68 65 41 64 | 64 72 65 73 73 3a 20 50 |ss(theAd|dress: P|
|00002ff0| 74 72 29 3a 20 50 74 72 | 3b 0d 54 68 65 20 65 66 |tr): Ptr|;.The ef|
|00003000| 66 65 63 74 20 6f 66 20 | 5f 53 74 72 69 70 41 64 |fect of |_StripAd|
|00003010| 64 72 65 73 73 20 6f 6e | 20 74 68 65 20 70 61 73 |dress on| the pas|
|00003020| 73 65 64 20 61 64 64 72 | 65 73 73 20 64 65 70 65 |sed addr|ess depe|
|00003030| 6e 64 73 20 6f 6e 20 74 | 68 65 20 6e 61 74 69 76 |nds on t|he nativ|
|00003040| 65 20 28 62 6f 6f 74 75 | 70 29 20 6d 6f 64 65 20 |e (bootu|p) mode |
|00003050| 74 68 65 20 6f 70 65 72 | 61 74 69 6e 67 20 73 79 |the oper|ating sy|
|00003060| 73 74 65 6d 20 75 73 65 | 73 2c 20 61 6e 64 20 6e |stem use|s, and n|
|00003070| 6f 74 20 6f 6e 20 74 68 | 65 20 63 75 72 72 65 6e |ot on th|e curren|
|00003080| 74 20 6d 6f 64 65 2e 20 | 20 54 68 65 20 66 6f 6c |t mode. | The fol|
|00003090| 6c 6f 77 69 6e 67 20 63 | 68 61 72 74 20 73 68 6f |lowing c|hart sho|
|000030a0| 77 73 20 74 68 65 20 72 | 65 73 75 6c 74 73 20 6f |ws the r|esults o|
|000030b0| 66 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 20 |f _Strip|Address |
|000030c0| 69 6e 20 61 6c 6c 20 6f | 66 20 69 74 73 20 63 6f |in all o|f its co|
|000030d0| 6e 66 69 67 75 72 61 74 | 69 6f 6e 73 3a 0d 4f 70 |nfigurat|ions:.Op|
|000030e0| 65 72 61 74 69 6e 67 20 | 53 79 73 74 65 6d 09 32 |erating |System.2|
|000030f0| 34 2d 42 69 74 20 4d 4d | 55 4d 6f 64 65 09 33 32 |4-Bit MM|UMode.32|
|00003100| 2d 42 69 74 20 4d 4d 55 | 4d 6f 64 65 0d 53 79 73 |-Bit MMU|Mode.Sys|
|00003110| 74 65 6d 20 53 6f 66 74 | 77 61 72 65 20 3c 20 37 |tem Soft|ware < 7|
|00003120| 2e 30 09 6d 61 73 6b 65 | 64 20 77 69 74 68 20 4c |.0.maske|d with L|
|00003130| 6f 33 42 79 74 65 73 09 | 6d 61 73 6b 65 64 20 77 |o3Bytes.|masked w|
|00003140| 69 74 68 20 4c 6f 33 42 | 79 74 65 73 0d 53 79 73 |ith Lo3B|ytes.Sys|
|00003150| 74 65 6d 20 37 2e 30 20 | 28 32 34 2d 42 69 74 20 |tem 7.0 |(24-Bit |
|00003160| 42 6f 6f 74 75 70 29 09 | 6d 61 73 6b 65 64 20 77 |Bootup).|masked w|
|00003170| 69 74 68 20 4c 6f 33 42 | 79 74 65 73 09 6d 61 73 |ith Lo3B|ytes.mas|
|00003180| 6b 65 64 20 77 69 74 68 | 20 4c 6f 33 42 79 74 65 |ked with| Lo3Byte|
|00003190| 73 0d 53 79 73 74 65 6d | 20 37 2e 30 20 28 33 32 |s.System| 7.0 (32|
|000031a0| 2d 42 69 74 20 42 6f 6f | 74 75 70 29 09 28 6e 65 |-Bit Boo|tup).(ne|
|000031b0| 76 65 72 20 69 6e 20 32 | 34 2d 62 69 74 20 6d 6f |ver in 2|4-bit mo|
|000031c0| 64 65 29 09 61 64 64 72 | 65 73 73 20 75 6e 63 68 |de).addr|ess unch|
|000031d0| 61 6e 67 65 64 0d 41 2f | 55 58 20 31 2e 31 2e 31 |anged.A/|UX 1.1.1|
|000031e0| 09 28 6e 65 76 65 72 20 | 69 6e 20 32 34 2d 62 69 |.(never |in 24-bi|
|000031f0| 74 20 6d 6f 64 65 29 09 | 61 64 64 72 65 73 73 20 |t mode).|address |
|00003200| 75 6e 63 68 61 6e 67 65 | 64 0d 41 2f 55 58 20 32 |unchange|d.A/UX 2|
|00003210| 2e 30 20 28 32 34 2d 42 | 69 74 20 4c 6f 67 69 6e |.0 (24-B|it Login|
|00003220| 29 09 6d 61 73 6b 65 64 | 20 77 69 74 68 20 4c 6f |).masked| with Lo|
|00003230| 33 42 79 74 65 73 09 6d | 61 73 6b 65 64 20 77 69 |3Bytes.m|asked wi|
|00003240| 74 68 20 4c 6f 33 42 79 | 74 65 73 0d 41 2f 55 58 |th Lo3By|tes.A/UX|
|00003250| 20 32 2e 30 20 28 33 32 | 2d 42 69 74 20 4c 6f 67 | 2.0 (32|-Bit Log|
|00003260| 69 6e 29 09 28 6e 65 76 | 65 72 20 69 6e 20 32 34 |in).(nev|er in 24|
|00003270| 2d 62 69 74 20 6d 6f 64 | 65 29 09 61 64 64 72 65 |-bit mod|e).addre|
|00003280| 73 73 20 75 6e 63 68 61 | 6e 67 65 64 0d 53 68 6f |ss uncha|nged.Sho|
|00003290| 75 6c 64 20 49 20 43 61 | 6c 6c 20 5f 53 74 72 69 |uld I Ca|ll _Stri|
|000032a0| 70 41 64 64 72 65 73 73 | 20 45 61 63 68 20 54 69 |pAddress| Each Ti|
|000032b0| 6d 65 20 49 20 55 73 65 | 20 41 6e 20 41 64 64 72 |me I Use| An Addr|
|000032c0| 65 73 73 3f 0d 49 6e 20 | 61 20 77 6f 72 64 2c 20 |ess?.In |a word, |
|000032d0| 6e 6f 2e 20 20 54 77 65 | 6e 74 79 2d 66 6f 75 72 |no. Twe|nty-four|
|000032e0| 2d 62 69 74 20 61 64 64 | 72 65 73 73 65 73 20 61 |-bit add|resses a|
|000032f0| 72 65 20 6e 6f 74 20 69 | 6e 68 65 72 65 6e 74 6c |re not i|nherentl|
|00003300| 79 20 64 61 6e 67 65 72 | 6f 75 73 d1 74 68 65 79 |y danger|ous.they|
|00003310| 20 6f 6e 6c 79 20 63 61 | 75 73 65 20 70 72 6f 62 | only ca|use prob|
|00003320| 6c 65 6d 73 20 77 68 65 | 6e 20 79 6f 75 20 61 63 |lems whe|n you ac|
|00003330| 63 65 73 73 20 74 68 65 | 6d 20 69 6e 20 33 32 2d |cess the|m in 32-|
|00003340| 62 69 74 20 6d 6f 64 65 | 2c 20 73 6f 20 75 6e 6c |bit mode|, so unl|
|00003350| 65 73 73 20 79 6f 75 20 | 61 72 65 20 73 77 69 74 |ess you |are swit|
|00003360| 63 68 69 6e 67 20 6d 6f | 64 65 73 20 77 69 74 68 |ching mo|des with|
|00003370| 20 74 68 65 20 5f 53 77 | 61 70 4d 4d 55 4d 6f 64 | the _Sw|apMMUMod|
|00003380| 65 20 74 72 61 70 2c 20 | 79 6f 75 20 72 61 72 65 |e trap, |you rare|
|00003390| 6c 79 20 6e 65 65 64 20 | 74 6f 20 63 61 6c 6c 20 |ly need |to call |
|000033a0| 5f 53 74 72 69 70 41 64 | 64 72 65 73 73 20 69 6e |_StripAd|dress in|
|000033b0| 73 69 64 65 20 61 20 d2 | 74 79 70 69 63 61 6c d3 |side a .|typical.|
|000033c0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 6f 72 20 | applica|tion or |
|000033d0| 64 72 69 76 65 72 2e 20 | 20 43 61 6c 6c 69 6e 67 |driver. | Calling|
|000033e0| 20 5f 53 74 72 69 70 41 | 64 64 72 65 73 73 20 69 | _StripA|ddress i|
|000033f0| 73 20 75 6e 6e 65 63 65 | 73 73 61 72 79 20 69 6e |s unnece|ssary in|
|00003400| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 74 | the fol|lowing t|
|00003410| 68 72 65 65 20 63 61 73 | 65 73 3a 0d 44 65 72 65 |hree cas|es:.Dere|
|00003420| 66 65 72 65 6e 63 69 6e | 67 20 41 20 50 6f 69 6e |ferencin|g A Poin|
|00003430| 74 65 72 20 6f 72 20 41 | 20 48 61 6e 64 6c 65 0d |ter or A| Handle.|
|00003440| 59 6f 75 20 64 6f 6e d5 | 74 20 6e 65 65 64 20 74 |You don.|t need t|
|00003450| 6f 20 63 61 6c 6c 20 5f | 53 74 72 69 70 41 64 64 |o call _|StripAdd|
|00003460| 72 65 73 73 20 62 65 66 | 6f 72 65 20 64 65 72 65 |ress bef|ore dere|
|00003470| 66 65 72 65 6e 63 69 6e | 67 20 61 20 70 6f 69 6e |ferencin|g a poin|
|00003480| 74 65 72 20 6f 72 20 61 | 20 68 61 6e 64 6c 65 20 |ter or a| handle |
|00003490| 75 6e 6c 65 73 73 20 79 | 6f 75 20 61 72 65 20 73 |unless y|ou are s|
|000034a0| 77 69 74 63 68 69 6e 67 | 20 74 68 65 20 43 50 55 |witching| the CPU|
|000034b0| 20 69 6e 74 6f 20 33 32 | 2d 62 69 74 20 6d 6f 64 | into 32|-bit mod|
|000034c0| 65 20 77 69 74 68 20 74 | 68 65 20 5f 53 77 61 70 |e with t|he _Swap|
|000034d0| 4d 4d 55 4d 6f 64 65 20 | 74 72 61 70 2e 20 20 41 |MMUMode |trap. A|
|000034e0| 66 74 65 72 20 61 6c 6c | 2c 20 69 66 20 74 68 69 |fter all|, if thi|
|000034f0| 73 20 69 73 20 61 20 66 | 75 6c 6c 2d 74 69 6d 65 |s is a f|ull-time|
|00003500| 20 33 32 2d 62 69 74 20 | 6d 61 63 68 69 6e 65 2c | 32-bit |machine,|
|00003510| 20 74 68 65 20 70 6f 69 | 6e 74 65 72 20 69 73 20 | the poi|nter is |
|00003520| 61 6c 77 61 79 73 20 61 | 20 76 61 6c 69 64 20 33 |always a| valid 3|
|00003530| 32 2d 62 69 74 20 61 64 | 64 72 65 73 73 2c 20 61 |2-bit ad|dress, a|
|00003540| 6e 64 20 69 66 20 69 74 | 20 69 73 20 61 20 32 34 |nd if it| is a 24|
|00003550| 2d 62 69 74 20 6d 61 63 | 68 69 6e 65 2c 20 79 6f |-bit mac|hine, yo|
|00003560| 75 72 20 61 64 64 72 65 | 73 73 65 73 20 61 72 65 |ur addre|sses are|
|00003570| 20 76 61 6c 69 64 20 32 | 34 2d 62 69 74 20 61 64 | valid 2|4-bit ad|
|00003580| 64 72 65 73 73 65 73 20 | 75 6e 6c 65 73 73 20 79 |dresses |unless y|
|00003590| 6f 75 20 73 77 69 74 63 | 68 20 74 68 65 20 6d 61 |ou switc|h the ma|
|000035a0| 63 68 69 6e 65 20 69 6e | 74 6f 20 33 32 2d 62 69 |chine in|to 32-bi|
|000035b0| 74 20 6d 6f 64 65 20 79 | 6f 75 72 73 65 6c 66 2e |t mode y|ourself.|
|000035c0| 0d 43 6f 6d 70 61 72 69 | 6e 67 20 50 6f 69 6e 74 |.Compari|ng Point|
|000035d0| 65 72 73 20 41 6e 64 20 | 48 61 6e 64 6c 65 73 20 |ers And |Handles |
|000035e0| 46 6f 72 20 45 71 75 61 | 6c 69 74 79 0d 41 73 20 |For Equa|lity.As |
|000035f0| 6c 6f 6e 67 20 61 73 20 | 79 6f 75 20 64 6f 6e d5 |long as |you don.|
|00003600| 74 20 66 75 74 7a 20 77 | 69 74 68 20 74 68 65 20 |t futz w|ith the |
|00003610| 68 69 67 68 20 62 69 74 | 73 20 6f 66 20 70 6f 69 |high bit|s of poi|
|00003620| 6e 74 65 72 73 20 61 6e | 64 20 68 61 6e 64 6c 65 |nters an|d handle|
|00003630| 73 20 79 6f 75 72 73 65 | 6c 66 20 28 77 68 69 63 |s yourse|lf (whic|
|00003640| 68 20 79 6f 75 20 63 61 | 6e 6e 6f 74 20 64 6f 20 |h you ca|nnot do |
|00003650| 73 61 66 65 6c 79 20 69 | 66 20 79 6f 75 20 77 61 |safely i|f you wa|
|00003660| 6e 74 20 74 6f 20 72 75 | 6e 20 69 6e 20 33 32 2d |nt to ru|n in 32-|
|00003670| 62 69 74 20 6d 6f 64 65 | 20 69 6e 20 61 6e 79 20 |bit mode| in any |
|00003680| 63 61 73 65 29 2c 20 79 | 6f 75 20 73 68 6f 75 6c |case), y|ou shoul|
|00003690| 64 20 62 65 20 61 62 6c | 65 20 74 6f 20 63 6f 6d |d be abl|e to com|
|000036a0| 70 61 72 65 20 70 6f 69 | 6e 74 65 72 73 20 61 6e |pare poi|nters an|
|000036b0| 64 20 68 61 6e 64 6c 65 | 73 20 66 6f 72 20 65 71 |d handle|s for eq|
|000036c0| 75 61 6c 69 74 79 20 77 | 69 74 68 6f 75 74 20 64 |uality w|ithout d|
|000036d0| 6f 69 6e 67 20 61 20 5f | 53 74 72 69 70 41 64 64 |oing a _|StripAdd|
|000036e0| 72 65 73 73 2c 20 73 69 | 6e 63 65 20 74 68 65 20 |ress, si|nce the |
|000036f0| 68 69 67 68 20 62 79 74 | 65 20 61 6c 77 61 79 73 |high byt|e always|
|00003700| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 73 61 | contain|s the sa|
|00003710| 6d 65 20 d2 67 61 72 62 | 61 67 65 d3 20 77 68 65 |me .garb|age. whe|
|00003720| 6e 20 79 6f 75 20 61 72 | 65 20 69 6e 20 32 34 2d |n you ar|e in 24-|
|00003730| 62 69 74 20 6d 6f 64 65 | 20 74 68 61 74 20 69 74 |bit mode| that it|
|00003740| 20 64 69 64 20 77 68 65 | 6e 20 74 68 65 20 70 6f | did whe|n the po|
|00003750| 69 6e 74 65 72 20 6f 72 | 20 68 61 6e 64 6c 65 20 |inter or| handle |
|00003760| 77 61 73 20 63 72 65 61 | 74 65 64 2e 20 20 54 68 |was crea|ted. Th|
|00003770| 65 72 65 20 69 73 20 61 | 6e 20 65 78 63 65 70 74 |ere is a|n except|
|00003780| 69 6f 6e 20 74 6f 20 74 | 68 69 73 20 72 75 6c 65 |ion to t|his rule|
|00003790| 2c 20 77 68 69 63 68 20 | 69 73 20 64 69 73 63 75 |, which |is discu|
|000037a0| 73 73 65 64 20 69 6e 20 | 74 68 65 20 d2 43 6f 6d |ssed in |the .Com|
|000037b0| 70 61 72 69 6e 67 20 44 | 65 72 65 66 65 72 65 6e |paring D|ereferen|
|000037c0| 63 65 64 20 48 61 6e 64 | 6c 65 73 d3 20 73 65 63 |ced Hand|les. sec|
|000037d0| 74 69 6f 6e 20 6c 61 74 | 65 72 20 69 6e 20 74 68 |tion lat|er in th|
|000037e0| 69 73 20 4e 6f 74 65 2e | 0d 50 65 72 66 6f 72 6d |is Note.|.Perform|
|000037f0| 69 6e 67 20 41 64 64 72 | 65 73 73 20 41 72 69 74 |ing Addr|ess Arit|
|00003800| 68 6d 65 74 69 63 0d 59 | 6f 75 20 64 6f 20 6e 6f |hmetic.Y|ou do no|
|00003810| 74 20 6e 65 65 64 20 74 | 6f 20 63 61 6c 6c 20 5f |t need t|o call _|
|00003820| 53 74 72 69 70 41 64 64 | 72 65 73 73 20 62 65 66 |StripAdd|ress bef|
|00003830| 6f 72 65 20 70 65 72 66 | 6f 72 6d 69 6e 67 20 61 |ore perf|orming a|
|00003840| 64 64 72 65 73 73 20 61 | 72 69 74 68 6d 65 74 69 |ddress a|rithmeti|
|00003850| 63 2c 20 73 69 6e 63 65 | 20 61 64 64 69 6e 67 20 |c, since| adding |
|00003860| 6f 72 20 73 75 62 74 72 | 61 63 74 69 6e 67 20 74 |or subtr|acting t|
|00003870| 77 6f 20 32 34 2d 62 69 | 74 20 61 64 64 72 65 73 |wo 24-bi|t addres|
|00003880| 73 65 73 20 61 6c 77 61 | 79 73 20 72 65 73 75 6c |ses alwa|ys resul|
|00003890| 74 73 20 69 6e 20 74 68 | 65 20 63 6f 72 72 65 63 |ts in th|e correc|
|000038a0| 74 20 32 34 2d 62 69 74 | 20 61 64 64 72 65 73 73 |t 24-bit| address|
|000038b0| 2c 20 72 65 67 61 72 64 | 6c 65 73 73 20 6f 66 20 |, regard|less of |
|000038c0| 74 68 65 20 68 69 67 68 | 20 62 79 74 65 20 76 61 |the high| byte va|
|000038d0| 6c 75 65 73 2e 20 20 52 | 61 6e 64 6f 6d 20 68 69 |lues. R|andom hi|
|000038e0| 67 68 20 62 79 74 65 20 | 76 61 6c 75 65 73 20 63 |gh byte |values c|
|000038f0| 61 6e 20 63 61 75 73 65 | 20 6f 72 64 65 72 65 64 |an cause| ordered|
|00003900| 20 63 6f 6d 70 61 72 69 | 73 6f 6e 73 20 6f 6e 20 | compari|sons on |
|00003910| 74 68 65 20 72 65 73 75 | 6c 74 73 20 6f 66 20 70 |the resu|lts of p|
|00003920| 6f 69 6e 74 65 72 20 61 | 72 69 74 68 6d 65 74 69 |ointer a|rithmeti|
|00003930| 63 20 74 6f 20 66 61 69 | 6c 2c 20 73 69 6e 63 65 |c to fai|l, since|
|00003940| 20 75 6e 64 65 72 66 6c | 6f 77 20 6f 72 20 6f 76 | underfl|ow or ov|
|00003950| 65 72 66 6c 6f 77 20 63 | 6f 75 6c 64 20 6f 63 63 |erflow c|ould occ|
|00003960| 75 72 2c 20 73 6f 20 79 | 6f 75 20 73 68 6f 75 6c |ur, so y|ou shoul|
|00003970| 64 20 6e 65 76 65 72 20 | 74 65 73 74 20 74 68 65 |d never |test the|
|00003980| 20 72 65 73 75 6c 74 20 | 6f 66 20 61 64 64 72 65 | result |of addre|
|00003990| 73 73 20 61 72 69 74 68 | 6d 65 74 69 63 20 61 67 |ss arith|metic ag|
|000039a0| 61 69 6e 73 74 20 61 20 | 76 61 6c 75 65 20 28 6f |ainst a |value (o|
|000039b0| 6e 6c 79 20 61 67 61 69 | 6e 73 74 20 4e 49 4c 20 |nly agai|nst NIL |
|000039c0| 6f 72 20 30 29 2e 0d 4f | 6b 61 79 2c 20 53 6f 20 |or 0)..O|kay, So |
|000039d0| 57 68 65 6e 20 44 6f 20 | 49 20 4e 65 65 64 20 54 |When Do |I Need T|
|000039e0| 6f 20 43 61 6c 6c 20 5f | 53 74 72 69 70 41 64 64 |o Call _|StripAdd|
|000039f0| 72 65 73 73 3f 0d 4f 72 | 64 65 72 65 64 20 41 64 |ress?.Or|dered Ad|
|00003a00| 64 72 65 73 73 20 43 6f | 6d 70 61 72 69 73 6f 6e |dress Co|mparison|
|00003a10| 0d 49 66 20 79 6f 75 20 | 6e 65 65 64 20 74 6f 20 |.If you |need to |
|00003a20| 73 6f 72 74 20 62 79 20 | 61 64 64 72 65 73 73 20 |sort by |address |
|00003a30| 6f 72 20 64 6f 20 61 6e | 79 20 6f 74 68 65 72 20 |or do an|y other |
|00003a40| 6b 69 6e 64 20 6f 66 20 | 6f 72 64 65 72 65 64 20 |kind of |ordered |
|00003a50| 61 64 64 72 65 73 73 20 | 63 6f 6d 70 61 72 69 73 |address |comparis|
|00003a60| 6f 6e 2c 20 79 6f 75 20 | 6e 65 65 64 20 74 6f 20 |on, you |need to |
|00003a70| 63 61 6c 6c 20 5f 53 74 | 72 69 70 41 64 64 72 65 |call _St|ripAddre|
|00003a80| 73 73 20 6f 6e 20 65 61 | 63 68 20 61 64 64 72 65 |ss on ea|ch addre|
|00003a90| 73 73 20 62 65 66 6f 72 | 65 20 64 6f 69 6e 67 20 |ss befor|e doing |
|00003aa0| 61 6e 79 20 6f 72 64 65 | 72 65 64 20 63 6f 6d 70 |any orde|red comp|
|00003ab0| 61 72 69 73 6f 6e 73 20 | 28 3e 2c 20 3c 2c 20 3e |arisons |(>, <, >|
|00003ac0| 3d 2c 20 3c 3d 29 2e 20 | 20 52 65 6d 65 6d 62 65 |=, <=). | Remembe|
|00003ad0| 72 2c 20 65 76 65 6e 20 | 74 68 6f 75 67 68 20 74 |r, even |though t|
|00003ae0| 68 65 20 43 50 55 20 6f | 6e 6c 79 20 75 73 65 73 |he CPU o|nly uses|
|00003af0| 20 74 68 65 20 6c 6f 77 | 65 72 20 32 34 20 62 69 | the low|er 24 bi|
|00003b00| 74 73 20 69 6e 20 32 34 | 2d 62 69 74 20 6d 6f 64 |ts in 24|-bit mod|
|00003b10| 65 2c 20 69 74 20 73 74 | 69 6c 6c 20 75 73 65 73 |e, it st|ill uses|
|00003b20| 20 61 6c 6c 20 33 32 20 | 62 69 74 73 20 77 68 65 | all 32 |bits whe|
|00003b30| 6e 20 70 65 72 66 6f 72 | 6d 69 6e 67 20 61 72 69 |n perfor|ming ari|
|00003b40| 74 68 6d 65 74 69 63 20 | 6f 70 65 72 61 74 69 6f |thmetic |operatio|
|00003b50| 6e 73 2e 0d 43 6f 6d 70 | 61 72 69 6e 67 20 44 65 |ns..Comp|aring De|
|00003b60| 72 65 66 65 72 65 6e 63 | 65 64 20 48 61 6e 64 6c |referenc|ed Handl|
|00003b70| 65 73 20 28 4d 61 73 74 | 65 72 20 50 6f 69 6e 74 |es (Mast|er Point|
|00003b80| 65 72 73 29 0d 49 66 20 | 79 6f 75 20 77 61 6e 74 |ers).If |you want|
|00003b90| 20 74 6f 20 70 65 72 66 | 6f 72 6d 20 61 6e 79 20 | to perf|orm any |
|00003ba0| 74 79 70 65 20 6f 66 20 | 63 6f 6d 70 61 72 69 73 |type of |comparis|
|00003bb0| 6f 6e 20 6f 6e 20 64 65 | 72 65 66 65 72 65 6e 63 |on on de|referenc|
|00003bc0| 65 64 20 68 61 6e 64 6c | 65 73 2c 20 79 6f 75 20 |ed handl|es, you |
|00003bd0| 6e 65 65 64 20 74 6f 20 | 63 61 6c 6c 20 5f 53 74 |need to |call _St|
|00003be0| 72 69 70 41 64 64 72 65 | 73 73 20 6f 6e 20 74 68 |ripAddre|ss on th|
|00003bf0| 65 20 76 61 6c 75 65 20 | 66 69 72 73 74 2c 20 73 |e value |first, s|
|00003c00| 69 6e 63 65 20 74 68 65 | 20 4d 65 6d 6f 72 79 20 |ince the| Memory |
|00003c10| 4d 61 6e 61 67 65 72 20 | 73 74 6f 72 65 73 20 69 |Manager |stores i|
|00003c20| 74 73 20 66 6c 61 67 73 | 20 69 6e 20 74 68 65 20 |ts flags| in the |
|00003c30| 68 69 67 68 20 62 79 74 | 65 20 6f 66 20 74 68 65 |high byt|e of the|
|00003c40| 20 4d 61 73 74 65 72 20 | 50 6f 69 6e 74 65 72 20 | Master |Pointer |
|00003c50| 6f 6e 20 32 34 2d 62 69 | 74 20 6d 61 63 68 69 6e |on 24-bi|t machin|
|00003c60| 65 73 2c 20 61 6e 64 20 | 74 68 65 73 65 20 66 6c |es, and |these fl|
|00003c70| 61 67 73 20 63 61 6e 20 | 63 68 61 6e 67 65 20 61 |ags can |change a|
|00003c80| 74 20 61 6e 79 20 74 69 | 6d 65 2e 20 20 4f 66 20 |t any ti|me. Of |
|00003c90| 63 6f 75 72 73 65 2c 20 | 74 68 69 73 20 69 6d 70 |course, |this imp|
|00003ca0| 6c 69 65 73 20 74 68 61 | 74 20 79 6f 75 20 6e 65 |lies tha|t you ne|
|00003cb0| 65 64 20 74 6f 20 63 61 | 6c 6c 20 5f 53 74 72 69 |ed to ca|ll _Stri|
|00003cc0| 70 41 64 64 72 65 73 73 | 20 62 65 66 6f 72 65 20 |pAddress| before |
|00003cd0| 63 6f 6d 70 61 72 69 6e | 67 20 74 77 6f 20 70 6f |comparin|g two po|
|00003ce0| 69 6e 74 65 72 73 20 66 | 6f 72 20 65 71 75 61 6c |inters f|or equal|
|00003cf0| 69 74 79 20 69 66 20 79 | 6f 75 20 63 6f 75 6c 64 |ity if y|ou could|
|00003d00| 20 62 65 20 63 6f 6d 70 | 61 72 69 6e 67 20 61 67 | be comp|aring ag|
|00003d10| 61 69 6e 73 74 20 61 20 | 64 65 72 65 66 65 72 65 |ainst a |derefere|
|00003d20| 6e 63 65 64 20 68 61 6e | 64 6c 65 2e 0d 4f 6e 20 |nced han|dle..On |
|00003d30| 48 61 6e 64 6c 65 73 20 | 41 6e 64 20 50 6f 69 6e |Handles |And Poin|
|00003d40| 74 65 72 73 20 42 65 66 | 6f 72 65 20 44 65 72 65 |ters Bef|ore Dere|
|00003d50| 66 65 72 65 6e 63 69 6e | 67 20 69 6e 20 33 32 2d |ferencin|g in 32-|
|00003d60| 42 69 74 20 4d 6f 64 65 | 0d 49 66 20 79 6f 75 20 |Bit Mode|.If you |
|00003d70| 61 72 65 20 67 6f 69 6e | 67 20 74 6f 20 73 77 69 |are goin|g to swi|
|00003d80| 74 63 68 20 74 68 65 20 | 6d 61 63 68 69 6e 65 20 |tch the |machine |
|00003d90| 69 6e 74 6f 20 33 32 2d | 62 69 74 20 6d 6f 64 65 |into 32-|bit mode|
|00003da0| 20 79 6f 75 72 73 65 6c | 66 2c 20 79 6f 75 20 6e | yoursel|f, you n|
|00003db0| 65 65 64 20 74 6f 20 63 | 61 6c 6c 20 5f 53 74 72 |eed to c|all _Str|
|00003dc0| 69 70 41 64 64 72 65 73 | 73 20 6f 6e 20 61 6c 6c |ipAddres|s on all|
|00003dd0| 20 32 34 2d 62 69 74 20 | 70 6f 69 6e 74 65 72 73 | 24-bit |pointers|
|00003de0| 20 61 6e 64 20 68 61 6e | 64 6c 65 73 20 74 68 61 | and han|dles tha|
|00003df0| 74 20 79 6f 75 20 61 63 | 63 65 73 73 20 77 68 69 |t you ac|cess whi|
|00003e00| 6c 65 20 69 6e 20 33 32 | 2d 62 69 74 20 6d 6f 64 |le in 32|-bit mod|
|00003e10| 65 2e 20 20 4f 66 20 63 | 6f 75 72 73 65 2c 20 79 |e. Of c|ourse, y|
|00003e20| 6f 75 20 68 61 64 20 62 | 65 74 74 65 72 20 6e 6f |ou had b|etter no|
|00003e30| 74 20 63 61 6c 6c 20 5f | 53 74 72 69 70 41 64 64 |t call _|StripAdd|
|00003e40| 72 65 73 73 20 6f 6e 20 | 61 20 33 32 2d 62 69 74 |ress on |a 32-bit|
|00003e50| 20 61 64 64 72 65 73 73 | 20 28 66 6f 72 20 65 78 | address| (for ex|
|00003e60| 61 6d 70 6c 65 2c 20 61 | 20 33 32 2d 62 69 74 20 |ample, a| 32-bit |
|00003e70| 4e 75 42 75 73 aa 20 73 | 6c 6f 74 20 61 64 64 72 |NuBus. s|lot addr|
|00003e80| 65 73 73 20 63 6f 75 6c | 64 20 67 65 6e 65 72 61 |ess coul|d genera|
|00003e90| 74 65 20 73 6f 6d 65 20 | 76 65 72 79 20 6e 69 63 |te some |very nic|
|00003ea0| 65 20 66 69 72 65 77 6f | 72 6b 73 20 69 66 20 79 |e firewo|rks if y|
|00003eb0| 6f 75 20 73 74 72 69 70 | 20 6f 66 66 20 69 74 73 |ou strip| off its|
|00003ec0| 20 68 69 67 68 20 62 79 | 74 65 20 77 69 74 68 20 | high by|te with |
|00003ed0| 5f 53 74 72 69 70 41 64 | 64 72 65 73 73 20 61 6e |_StripAd|dress an|
|00003ee0| 64 20 74 68 65 6e 20 74 | 72 79 20 74 6f 20 61 63 |d then t|ry to ac|
|00003ef0| 63 65 73 73 20 74 68 65 | 20 d2 69 6d 70 72 6f 76 |cess the| .improv|
|00003f00| 65 64 d3 20 61 64 64 72 | 65 73 73 29 2e 20 20 46 |ed. addr|ess). F|
|00003f10| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 74 68 65 20 |or examp|le, the |
|00003f20| 33 32 2d 42 69 74 20 51 | 75 69 63 6b 44 72 61 77 |32-Bit Q|uickDraw|
|00003f30| 20 72 6f 75 74 69 6e 65 | 20 5f 47 65 74 50 69 78 | routine| _GetPix|
|00003f40| 42 61 73 65 41 64 64 72 | 20 72 65 74 75 72 6e 73 |BaseAddr| returns|
|00003f50| 20 61 20 33 32 2d 62 69 | 74 20 61 64 64 72 65 73 | a 32-bi|t addres|
|00003f60| 73 2e 20 20 52 65 66 65 | 72 20 74 6f 20 54 65 63 |s. Refe|r to Tec|
|00003f70| 68 6e 69 63 61 6c 20 4e | 6f 74 65 20 23 32 37 37 |hnical N|ote #277|
|00003f80| 2c 20 33 32 2d 42 69 74 | 20 51 75 69 63 6b 44 72 |, 32-Bit| QuickDr|
|00003f90| 61 77 3a 20 20 56 65 72 | 73 69 6f 6e 20 31 2e 32 |aw: Ver|sion 1.2|
|00003fa0| 20 46 65 61 74 75 72 65 | 73 2c 20 66 6f 72 20 6d | Feature|s, for m|
|00003fb0| 6f 72 65 20 64 65 74 61 | 69 6c 73 20 61 62 6f 75 |ore deta|ils abou|
|00003fc0| 74 20 33 32 2d 42 69 74 | 20 51 75 69 63 6b 44 72 |t 32-Bit| QuickDr|
|00003fd0| 61 77 20 61 6e 64 20 33 | 32 2d 62 69 74 20 61 64 |aw and 3|2-bit ad|
|00003fe0| 64 72 65 73 73 69 6e 67 | 2e 0d 50 72 6f 67 72 61 |dressing|..Progra|
|00003ff0| 6d 20 43 6f 75 6e 74 65 | 72 20 69 6e 20 33 32 2d |m Counte|r in 32-|
|00004000| 42 69 74 20 4d 6f 64 65 | 0d 54 68 69 73 20 69 73 |Bit Mode|.This is|
|00004010| 73 75 65 20 69 73 20 64 | 65 73 63 72 69 62 65 64 |sue is d|escribed|
|00004020| 20 69 6e 20 64 65 70 74 | 68 20 69 6e 20 54 65 63 | in dept|h in Tec|
|00004030| 68 6e 69 63 61 6c 20 4e | 6f 74 65 20 23 32 32 38 |hnical N|ote #228|
|00004040| 2c 20 55 73 65 20 43 61 | 72 65 20 57 68 65 6e 20 |, Use Ca|re When |
|00004050| 53 77 61 70 70 69 6e 67 | 20 4d 4d 55 20 4d 6f 64 |Swapping| MMU Mod|
|00004060| 65 2c 20 73 6f 20 74 68 | 69 73 20 4e 6f 74 65 20 |e, so th|is Note |
|00004070| 77 6f 6e d5 74 20 67 6f | 20 69 6e 74 6f 20 64 65 |won.t go| into de|
|00004080| 70 74 68 20 68 65 72 65 | 2e 20 20 42 61 73 69 63 |pth here|. Basic|
|00004090| 61 6c 6c 79 2c 20 69 66 | 20 79 6f 75 20 61 72 65 |ally, if| you are|
|000040a0| 20 67 6f 69 6e 67 20 74 | 6f 20 73 77 69 74 63 68 | going t|o switch|
|000040b0| 20 69 6e 74 6f 20 33 32 | 2d 62 69 74 20 6d 6f 64 | into 32|-bit mod|
|000040c0| 65 20 77 69 74 68 69 6e | 20 61 20 63 6f 64 65 20 |e within| a code |
|000040d0| 72 65 73 6f 75 72 63 65 | 2c 20 79 6f 75 20 6e 65 |resource|, you ne|
|000040e0| 65 64 20 74 6f 20 6d 61 | 6b 65 20 73 75 72 65 20 |ed to ma|ke sure |
|000040f0| 74 68 61 74 20 79 6f 75 | 72 20 50 72 6f 67 72 61 |that you|r Progra|
|00004100| 6d 20 43 6f 75 6e 74 65 | 72 20 28 50 43 29 20 63 |m Counte|r (PC) c|
|00004110| 6f 6e 74 61 69 6e 73 20 | 61 20 76 61 6c 69 64 20 |ontains |a valid |
|00004120| 33 32 2d 62 69 74 20 61 | 64 64 72 65 73 73 20 62 |32-bit a|ddress b|
|00004130| 65 66 6f 72 65 20 79 6f | 75 20 73 77 69 74 63 68 |efore yo|u switch|
|00004140| 20 6d 6f 64 65 73 2e 0d | 4f 6e 65 20 6e 6f 74 2d | modes..|One not-|
|00004150| 73 6f 2d 6f 62 76 69 6f | 75 73 20 65 78 61 6d 70 |so-obvio|us examp|
|00004160| 6c 65 20 6f 66 20 74 68 | 69 73 20 63 61 73 65 20 |le of th|is case |
|00004170| 69 73 20 61 20 74 72 61 | 70 20 70 61 74 63 68 20 |is a tra|p patch |
|00004180| 74 68 61 74 20 6c 69 76 | 65 73 20 69 6e 20 61 20 |that liv|es in a |
|00004190| 62 6c 6f 63 6b 20 69 6e | 20 74 68 65 20 68 65 61 |block in| the hea|
|000041a0| 70 2e 20 20 49 66 20 79 | 6f 75 20 70 61 73 73 20 |p. If y|ou pass |
|000041b0| 74 68 65 20 61 64 64 72 | 65 73 73 20 6f 66 20 74 |the addr|ess of t|
|000041c0| 68 65 20 62 6c 6f 63 6b | 20 74 6f 20 74 68 65 20 |he block| to the |
|000041d0| 5f 53 65 74 54 72 61 70 | 41 64 64 72 65 73 73 20 |_SetTrap|Address |
|000041e0| 74 72 61 70 20 77 69 74 | 68 6f 75 74 20 66 69 72 |trap wit|hout fir|
|000041f0| 73 74 20 63 61 6c 6c 69 | 6e 67 20 5f 53 74 72 69 |st calli|ng _Stri|
|00004200| 70 41 64 64 72 65 73 73 | 20 6f 6e 20 69 74 20 61 |pAddress| on it a|
|00004210| 6e 64 20 74 68 65 20 70 | 61 74 63 68 65 64 20 74 |nd the p|atched t|
|00004220| 72 61 70 20 69 73 20 6c | 61 74 65 72 20 63 61 6c |rap is l|ater cal|
|00004230| 6c 65 64 20 69 6e 20 33 | 32 2d 62 69 74 20 6d 6f |led in 3|2-bit mo|
|00004240| 64 65 2c 20 62 61 64 20 | 74 68 69 6e 67 73 20 68 |de, bad |things h|
|00004250| 61 70 70 65 6e 2e 20 20 | 53 70 65 63 69 66 69 63 |appen. |Specific|
|00004260| 61 6c 6c 79 2c 20 74 68 | 65 20 68 69 67 68 20 62 |ally, th|e high b|
|00004270| 79 74 65 20 6f 66 20 74 | 68 65 20 61 64 64 72 65 |yte of t|he addre|
|00004280| 73 73 20 63 6f 6e 74 61 | 69 6e 73 20 4d 65 6d 6f |ss conta|ins Memo|
|00004290| 72 79 20 4d 61 6e 61 67 | 65 72 20 69 6e 66 6f 72 |ry Manag|er infor|
|000042a0| 6d 61 74 69 6f 6e 2c 20 | 73 6f 20 77 68 65 6e 20 |mation, |so when |
|000042b0| 74 68 65 20 70 61 74 63 | 68 65 64 20 74 72 61 70 |the patc|hed trap|
|000042c0| 20 69 73 20 63 61 6c 6c | 65 64 2c 20 74 68 65 20 | is call|ed, the |
|000042d0| 50 43 20 70 6f 69 6e 74 | 73 20 74 6f 20 6e 65 76 |PC point|s to nev|
|000042e0| 65 72 2d 6e 65 76 65 72 | 20 6c 61 6e 64 2c 20 6d |er-never| land, m|
|000042f0| 61 6b 69 6e 67 20 72 65 | 73 75 6c 74 73 20 65 78 |aking re|sults ex|
|00004300| 74 72 65 6d 65 6c 79 20 | 75 6e 70 72 65 64 69 63 |tremely |unpredic|
|00004310| 74 61 62 6c 65 2e 20 20 | 53 6f 20 69 66 20 79 6f |table. |So if yo|
|00004320| 75 20 61 72 65 20 67 6f | 69 6e 67 20 74 6f 20 70 |u are go|ing to p|
|00004330| 61 74 63 68 20 61 20 74 | 72 61 70 20 75 73 69 6e |atch a t|rap usin|
|00004340| 67 20 74 68 65 20 61 64 | 64 72 65 73 73 20 6f 66 |g the ad|dress of|
|00004350| 20 61 20 68 65 61 70 20 | 62 6c 6f 63 6b 2c 20 63 | a heap |block, c|
|00004360| 61 6c 6c 20 5f 53 74 72 | 69 70 41 64 64 72 65 73 |all _Str|ipAddres|
|00004370| 73 20 6f 6e 20 69 74 20 | 66 69 72 73 74 2e 0d 46 |s on it |first..F|
|00004380| 69 6c 65 6e 61 6d 65 73 | 20 50 61 73 73 65 64 20 |ilenames| Passed |
|00004390| 54 6f 20 5f 4f 70 65 6e | 52 65 73 46 69 6c 65 20 |To _Open|ResFile |
|000043a0| 41 6e 64 20 5f 4f 70 65 | 6e 52 46 50 65 72 6d 0d |And _Ope|nRFPerm.|
|000043b0| 54 68 69 73 20 69 73 73 | 75 65 20 69 73 20 64 65 |This iss|ue is de|
|000043c0| 73 63 72 69 62 65 64 20 | 69 6e 20 64 65 70 74 68 |scribed |in depth|
|000043d0| 20 69 6e 20 54 65 63 68 | 6e 69 63 61 6c 20 4e 6f | in Tech|nical No|
|000043e0| 74 65 20 23 32 33 32 2c | 20 53 74 72 69 70 20 57 |te #232,| Strip W|
|000043f0| 69 74 68 20 5f 4f 70 65 | 6e 52 65 73 46 69 6c 65 |ith _Ope|nResFile|
|00004400| 20 61 6e 64 20 5f 4f 70 | 65 6e 52 46 50 65 72 6d | and _Op|enRFPerm|
|00004410| 2e 20 20 41 20 70 61 74 | 63 68 20 74 6f 20 74 68 |. A pat|ch to th|
|00004420| 65 73 65 20 74 72 61 70 | 73 20 63 61 6c 6c 73 20 |ese trap|s calls |
|00004430| 5f 52 65 63 6f 76 65 72 | 48 61 6e 64 6c 65 20 6f |_Recover|Handle o|
|00004440| 6e 20 74 68 65 20 73 74 | 72 69 6e 67 20 70 61 73 |n the st|ring pas|
|00004450| 73 65 64 20 74 6f 20 74 | 68 65 73 65 20 72 6f 75 |sed to t|hese rou|
|00004460| 74 69 6e 65 73 2c 20 77 | 68 69 63 68 20 63 61 6e |tines, w|hich can|
|00004470| 20 63 61 75 73 65 20 63 | 72 61 73 68 65 73 20 69 | cause c|rashes i|
|00004480| 66 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 20 |f _Strip|Address |
|00004490| 69 73 20 6e 6f 74 20 63 | 61 6c 6c 65 64 2e 0d 57 |is not c|alled..W|
|000044a0| 68 61 61 61 68 68 21 20 | 5f 53 74 72 69 70 41 64 |haaahh! |_StripAd|
|000044b0| 64 72 65 73 73 20 49 73 | 20 54 6f 6f 20 53 6c 6f |dress Is| Too Slo|
|000044c0| 77 21 20 20 48 6f 77 20 | 43 61 6e 20 49 20 4d 61 |w! How |Can I Ma|
|000044d0| 6b 65 20 49 74 20 46 61 | 73 74 65 72 3f 0d 49 66 |ke It Fa|ster?.If|
|000044e0| 20 79 6f 75 20 66 6f 6c | 6c 6f 77 20 74 68 65 20 | you fol|low the |
|000044f0| 67 75 69 64 65 6c 69 6e | 65 73 20 64 69 73 63 75 |guidelin|es discu|
|00004500| 73 73 65 64 20 69 6e 20 | 74 68 69 73 20 4e 6f 74 |ssed in |this Not|
|00004510| 65 2c 20 73 70 65 65 64 | 20 73 68 6f 75 6c 64 6e |e, speed| shouldn|
|00004520| d5 74 20 62 65 20 61 6e | 20 69 73 73 75 65 2c 20 |.t be an| issue, |
|00004530| 73 69 6e 63 65 20 79 6f | 75 20 61 72 65 20 63 61 |since yo|u are ca|
|00004540| 6c 6c 69 6e 67 20 5f 53 | 74 72 69 70 41 64 64 72 |lling _S|tripAddr|
|00004550| 65 73 73 20 72 61 72 65 | 6c 79 2c 20 69 66 20 61 |ess rare|ly, if a|
|00004560| 74 20 61 6c 6c 2e 20 20 | 4a 75 73 74 20 66 6f 72 |t all. |Just for|
|00004570| 20 74 68 65 20 73 61 6b | 65 20 6f 66 20 61 72 67 | the sak|e of arg|
|00004580| 75 6d 65 6e 74 2c 20 74 | 68 6f 75 67 68 2c 20 6c |ument, t|hough, l|
|00004590| 65 74 d5 73 20 73 61 79 | 20 74 68 61 74 20 79 6f |et.s say| that yo|
|000045a0| 75 20 64 6f 20 63 61 6c | 6c 20 5f 53 74 72 69 70 |u do cal|l _Strip|
|000045b0| 41 64 64 72 65 73 73 20 | 69 6e 73 69 64 65 20 6f |Address |inside o|
|000045c0| 66 20 61 20 74 69 6d 65 | 2d 63 72 69 74 69 63 61 |f a time|-critica|
|000045d0| 6c 20 6c 6f 6f 70 20 69 | 6e 73 69 64 65 20 61 6e |l loop i|nside an|
|000045e0| 20 69 6e 74 65 72 72 75 | 70 74 20 72 6f 75 74 69 | interru|pt routi|
|000045f0| 6e 65 2e 20 20 54 68 65 | 20 73 6f 6c 75 74 69 6f |ne. The| solutio|
|00004600| 6e 20 74 6f 20 74 68 69 | 73 20 70 72 6f 62 6c 65 |n to thi|s proble|
|00004610| 6d 20 69 73 20 74 6f 20 | 63 61 63 68 65 20 74 68 |m is to |cache th|
|00004620| 65 20 6d 61 73 6b 20 74 | 68 61 74 20 5f 53 74 72 |e mask t|hat _Str|
|00004630| 69 70 41 64 64 72 65 73 | 73 20 75 73 65 73 20 74 |ipAddres|s uses t|
|00004640| 6f 20 64 6f 20 69 74 73 | 20 77 6f 72 6b 2e 20 20 |o do its| work. |
|00004650| 48 65 72 65 d5 73 20 68 | 6f 77 3a 0d 4d 50 57 20 |Here.s h|ow:.MPW |
|00004660| 43 3a 0d 20 20 6c 6f 6e | 67 20 67 53 74 72 69 70 |C:. lon|g gStrip|
|00004670| 41 64 64 72 65 73 73 4d | 61 73 6b 3b 20 20 20 20 |AddressM|ask; |
|00004680| 20 20 20 20 2f 2a 20 6f | 75 72 20 63 61 63 68 65 | /* o|ur cache|
|00004690| 64 20 67 6c 6f 62 61 6c | 20 6d 61 73 6b 20 76 61 |d global| mask va|
|000046a0| 72 69 61 62 6c 65 20 2a | 2f 0d 20 20 2f 2a 20 79 |riable *|/. /* y|
|000046b0| 6f 75 20 63 61 6e 20 75 | 73 65 20 74 68 69 73 20 |ou can u|se this |
|000046c0| 6d 61 63 72 6f 20 74 6f | 20 64 6f 20 61 20 71 75 |macro to| do a qu|
|000046d0| 69 63 6b 20 5f 53 74 72 | 69 70 41 64 64 72 65 73 |ick _Str|ipAddres|
|000046e0| 73 20 65 71 75 69 76 61 | 6c 65 6e 74 20 2a 2f 0d |s equiva|lent */.|
|000046f0| 20 20 23 64 65 66 69 6e | 65 20 51 75 69 63 6b 53 | #defin|e QuickS|
|00004700| 74 72 69 70 28 70 74 72 | 29 20 28 28 70 74 72 29 |trip(ptr|) ((ptr)|
|00004710| 20 26 20 67 53 74 72 69 | 70 41 64 64 72 65 73 73 | & gStri|pAddress|
|00004720| 4d 61 73 6b 29 0d 20 20 | 6d 61 69 6e 28 29 0d 20 |Mask). |main(). |
|00004730| 20 7b 0d 20 20 20 20 2f | 2a 20 64 6f 20 61 6c 6c | {. /|* do all|
|00004740| 20 6f 66 20 74 68 65 20 | 75 73 75 61 6c 20 69 6e | of the |usual in|
|00004750| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 2a 2f 0d |itializa|tion */.|
|00004760| 20 20 20 20 2f 2a 20 63 | 61 63 68 65 20 5f 53 74 | /* c|ache _St|
|00004770| 72 69 70 41 64 64 72 65 | 73 73 20 72 65 73 75 6c |ripAddre|ss resul|
|00004780| 74 20 2a 2f 0d 20 20 20 | 20 67 53 74 72 69 70 41 |t */. | gStripA|
|00004790| 64 64 72 65 73 73 4d 61 | 73 6b 20 3d 20 30 78 66 |ddressMa|sk = 0xf|
|000047a0| 66 66 66 66 66 66 66 3b | 0d 20 20 20 20 67 53 74 |fffffff;|. gSt|
|000047b0| 72 69 70 41 64 64 72 65 | 73 73 4d 61 73 6b 20 3d |ripAddre|ssMask =|
|000047c0| 20 28 6c 6f 6e 67 29 20 | 53 74 72 69 70 41 64 64 | (long) |StripAdd|
|000047d0| 72 65 73 73 28 28 50 74 | 72 29 20 67 53 74 72 69 |ress((Pt|r) gStri|
|000047e0| 70 41 64 64 72 65 73 73 | 4d 61 73 6b 29 3b 0d 20 |pAddress|Mask);. |
|000047f0| 20 20 20 2f 2a 20 68 61 | 76 65 20 79 6f 75 72 20 | /* ha|ve your |
|00004800| 70 72 6f 67 72 61 6d 20 | 64 6f 20 73 6f 6d 65 74 |program |do somet|
|00004810| 68 69 6e 67 20 75 73 65 | 66 75 6c 20 68 65 72 65 |hing use|ful here|
|00004820| c9 20 2a 2f 0d 20 20 7d | 0d 4d 50 57 20 50 61 73 |. */. }|.MPW Pas|
|00004830| 63 61 6c 3a 0d 20 20 50 | 52 4f 47 52 41 4d 20 53 |cal:. P|ROGRAM S|
|00004840| 74 72 69 70 54 65 61 73 | 65 3b 0d 20 20 56 41 52 |tripTeas|e;. VAR|
|00004850| 0d 20 20 20 20 67 53 74 | 72 69 70 41 64 64 72 65 |. gSt|ripAddre|
|00004860| 73 73 4d 61 73 6b 20 3a | 20 4c 4f 4e 47 49 4e 54 |ssMask :| LONGINT|
|00004870| 3b 20 20 20 20 20 20 20 | 20 7b 20 6f 75 72 20 63 |; | { our c|
|00004880| 61 63 68 65 64 20 67 6c | 6f 62 61 6c 20 6d 61 73 |ached gl|obal mas|
|00004890| 6b 20 76 61 72 69 61 62 | 6c 65 20 7d 0d 20 20 7b |k variab|le }. {|
|000048a0| 20 79 6f 75 20 63 61 6e | 20 75 73 65 20 74 68 69 | you can| use thi|
|000048b0| 73 20 66 75 6e 63 74 69 | 6f 6e 20 74 6f 20 64 6f |s functi|on to do|
|000048c0| 20 61 20 71 75 69 63 6b | 20 5f 53 74 72 69 70 41 | a quick| _StripA|
|000048d0| 64 64 72 65 73 73 20 65 | 71 75 69 76 61 6c 65 6e |ddress e|quivalen|
|000048e0| 74 20 7d 0d 20 20 46 55 | 4e 43 54 49 4f 4e 20 51 |t }. FU|NCTION Q|
|000048f0| 75 69 63 6b 53 74 72 69 | 70 28 74 68 65 50 74 72 |uickStri|p(thePtr|
|00004900| 20 3a 20 50 74 72 29 20 | 3a 20 50 74 72 3b 0d 20 | : Ptr) |: Ptr;. |
|00004910| 20 42 45 47 49 4e 0d 20 | 20 20 20 51 75 69 63 6b | BEGIN. | Quick|
|00004920| 53 74 72 69 70 20 3a 3d | 20 50 74 72 28 42 41 4e |Strip :=| Ptr(BAN|
|00004930| 44 28 4c 4f 4e 47 49 4e | 54 28 74 68 65 50 74 72 |D(LONGIN|T(thePtr|
|00004940| 29 2c 67 53 74 72 69 70 | 41 64 64 72 65 73 73 4d |),gStrip|AddressM|
|00004950| 61 73 6b 29 29 3b 0d 20 | 20 45 4e 44 3b 0d 20 20 |ask));. | END;. |
|00004960| 42 45 47 49 4e 0d 20 20 | 20 20 7b 20 64 6f 20 61 |BEGIN. | { do a|
|00004970| 6c 6c 20 6f 66 20 74 68 | 65 20 75 73 75 61 6c 20 |ll of th|e usual |
|00004980| 69 6e 69 74 69 61 6c 69 | 7a 61 74 69 6f 6e 20 7d |initiali|zation }|
|00004990| 0d 20 20 20 20 7b 20 63 | 61 63 68 65 20 5f 53 74 |. { c|ache _St|
|000049a0| 72 69 70 41 64 64 72 65 | 73 73 20 72 65 73 75 6c |ripAddre|ss resul|
|000049b0| 74 20 7d 0d 20 20 20 20 | 67 53 74 72 69 70 41 64 |t }. |gStripAd|
|000049c0| 64 72 65 73 73 4d 61 73 | 6b 20 3a 3d 20 24 46 46 |dressMas|k := $FF|
|000049d0| 46 46 46 46 46 46 3b 0d | 20 20 20 20 67 53 74 72 |FFFFFF;.| gStr|
|000049e0| 69 70 41 64 64 72 65 73 | 73 4d 61 73 6b 20 3a 3d |ipAddres|sMask :=|
|000049f0| 20 4c 4f 4e 47 49 4e 54 | 28 53 74 72 69 70 41 64 | LONGINT|(StripAd|
|00004a00| 64 72 65 73 73 28 50 74 | 72 28 67 53 74 72 69 70 |dress(Pt|r(gStrip|
|00004a10| 41 64 64 72 65 73 73 4d | 61 73 6b 29 29 29 3b 0d |AddressM|ask)));.|
|00004a20| 20 20 20 20 7b 20 68 61 | 76 65 20 79 6f 75 72 20 | { ha|ve your |
|00004a30| 70 72 6f 67 72 61 6d 20 | 64 6f 20 73 6f 6d 65 74 |program |do somet|
|00004a40| 68 69 6e 67 20 75 73 65 | 66 75 6c 20 68 65 72 65 |hing use|ful here|
|00004a50| c9 20 7d 0d 20 20 45 4e | 44 2e 0d 54 68 69 73 20 |. }. EN|D..This |
|00004a60| 74 65 63 68 6e 69 71 75 | 65 20 61 76 6f 69 64 73 |techniqu|e avoids|
|00004a70| 20 74 68 65 20 6f 76 65 | 72 68 65 61 64 20 6f 66 | the ove|rhead of|
|00004a80| 20 74 68 65 20 54 72 61 | 70 20 44 69 73 70 61 74 | the Tra|p Dispat|
|00004a90| 63 68 65 72 2c 20 77 6f | 72 6b 73 20 6f 6e 20 70 |cher, wo|rks on p|
|00004aa0| 72 65 73 65 6e 74 20 61 | 6e 64 20 66 75 74 75 72 |resent a|nd futur|
|00004ab0| 65 20 6d 61 63 68 69 6e | 65 73 2c 20 61 6e 64 20 |e machin|es, and |
|00004ac0| 69 74 20 73 68 6f 75 6c | 64 20 62 65 20 66 61 73 |it shoul|d be fas|
|00004ad0| 74 20 65 6e 6f 75 67 68 | 20 66 6f 72 20 61 6e 79 |t enough| for any|
|00004ae0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e d1 6a 75 73 | applica|tion.jus|
|00004af0| 74 20 63 61 6c 6c 20 74 | 68 65 20 51 75 69 63 6b |t call t|he Quick|
|00004b00| 53 74 72 69 70 20 72 6f | 75 74 69 6e 65 20 28 6d |Strip ro|utine (m|
|00004b10| 61 63 72 6f 20 74 6f 20 | 75 73 20 43 20 77 65 65 |acro to |us C wee|
|00004b20| 6e 69 65 73 29 20 69 6e | 20 70 6c 61 63 65 20 6f |nies) in| place o|
|00004b30| 66 20 5f 53 74 72 69 70 | 41 64 64 72 65 73 73 2e |f _Strip|Address.|
|00004b40| 0d 46 75 72 74 68 65 72 | 20 52 65 66 65 72 65 6e |.Further| Referen|
|00004b50| 63 65 3a 0d a5 09 49 6e | 73 69 64 65 20 4d 61 63 |ce:...In|side Mac|
|00004b60| 69 6e 74 6f 73 68 2c 20 | 56 6f 6c 75 6d 65 20 56 |intosh, |Volume V|
|00004b70| 2c 20 54 68 65 20 4f 53 | 20 55 74 69 6c 69 74 69 |, The OS| Utiliti|
|00004b80| 65 73 0d a5 09 54 65 63 | 68 6e 69 63 61 6c 20 4e |es...Tec|hnical N|
|00004b90| 6f 74 65 20 4d 2e 4f 56 | 2e 33 32 42 69 74 43 6c |ote M.OV|.32BitCl|
|00004ba0| 65 61 6e 20 d1 0d 09 09 | 20 54 68 65 20 4a 6f 79 |ean ....| The Joy|
|00004bb0| 20 4f 66 20 42 65 69 6e | 67 20 33 32 2d 42 69 74 | Of Bein|g 32-Bit|
|00004bc0| 20 43 6c 65 61 6e 0d a5 | 09 54 65 63 68 6e 69 63 | Clean..|.Technic|
|00004bd0| 61 6c 20 4e 6f 74 65 20 | 4d 2e 4d 45 2e 53 77 61 |al Note |M.ME.Swa|
|00004be0| 70 4d 4d 55 4d 6f 64 65 | 20 d1 0d 09 09 20 55 73 |pMMUMode| .... Us|
|00004bf0| 65 20 43 61 72 65 20 57 | 68 65 6e 20 53 77 61 70 |e Care W|hen Swap|
|00004c00| 70 69 6e 67 20 4d 4d 55 | 20 4d 6f 64 65 0d a5 09 |ping MMU| Mode...|
|00004c10| 54 65 63 68 6e 69 63 61 | 6c 20 4e 6f 74 65 20 4d |Technica|l Note M|
|00004c20| 2e 54 42 2e 53 74 72 69 | 70 4f 70 65 6e 52 65 73 |.TB.Stri|pOpenRes|
|00004c30| 46 69 6c 65 20 d1 0d 09 | 09 53 74 72 69 70 20 57 |File ...|.Strip W|
|00004c40| 69 74 68 20 5f 4f 70 65 | 6e 52 65 73 46 69 6c 65 |ith _Ope|nResFile|
|00004c50| 20 41 6e 64 20 5f 4f 70 | 65 6e 52 46 50 65 72 6d | And _Op|enRFPerm|
|00004c60| 0d a5 09 54 65 63 68 6e | 69 63 61 6c 20 4e 6f 74 |...Techn|ical Not|
|00004c70| 65 20 4d 2e 49 4d 2e 33 | 32 42 69 74 51 44 20 d1 |e M.IM.3|2BitQD .|
|00004c80| 0d 09 09 20 33 32 2d 42 | 69 74 20 51 75 69 63 6b |... 32-B|it Quick|
|00004c90| 44 72 61 77 3a 20 20 56 | 65 72 73 69 6f 6e 20 31 |Draw: V|ersion 1|
|00004ca0| 2e 32 20 46 65 61 74 75 | 72 65 73 0d 4e 75 42 75 |.2 Featu|res.NuBu|
|00004cb0| 73 20 69 73 20 61 20 74 | 72 61 64 65 6d 61 72 6b |s is a t|rademark|
|00004cc0| 20 6f 66 20 54 65 78 61 | 73 20 49 6e 73 74 72 75 | of Texa|s Instru|
|00004cd0| 6d 65 6e 74 73 2e 0d 4e | 6f 74 69 63 65 3a 20 54 |ments..N|otice: T|
|00004ce0| 68 65 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 69 |he infor|mation i|
|00004cf0| 6e 20 74 68 69 73 20 54 | 65 63 68 6e 69 63 61 6c |n this T|echnical|
|00004d00| 20 4e 6f 74 65 20 63 61 | 6e 20 6e 6f 77 20 62 65 | Note ca|n now be|
|00004d10| 20 66 6f 75 6e 64 20 69 | 6e 20 49 6e 73 69 64 65 | found i|n Inside|
|00004d20| 20 4d 61 63 69 6e 74 6f | 73 68 3a 4d 65 6d 6f 72 | Macinto|sh:Memor|
|00004d30| 79 20 70 61 67 65 73 20 | 34 2d 32 30 20 74 68 72 |y pages |4-20 thr|
|00004d40| 6f 75 67 68 20 34 2d 32 | 31 2e 20 20 54 68 69 73 |ough 4-2|1. This|
|00004d50| 20 6e 6f 74 65 20 77 69 | 6c 6c 20 62 65 20 72 65 | note wi|ll be re|
|00004d60| 6d 6f 76 65 64 20 66 72 | 6f 6d 20 74 68 65 20 54 |moved fr|om the T|
|00004d70| 65 63 68 6e 69 63 61 6c | 20 4e 6f 74 65 20 6c 69 |echnical| Note li|
|00004d80| 62 72 61 72 79 20 69 6e | 20 74 68 65 20 6e 65 61 |brary in| the nea|
|00004d90| 72 20 66 75 74 75 72 65 | 2e 0d 4d 45 20 37 20 2d |r future|..ME 7 -|
|00004da0| 20 53 77 61 70 70 69 6e | 67 20 4d 4d 55 20 4d 6f | Swappin|g MMU Mo|
|00004db0| 64 65 20 3a 20 55 73 65 | 20 43 61 72 65 0d 4d 65 |de : Use| Care.Me|
|00004dc0| 6d 6f 72 79 09 4d 2e 4d | 45 2e 53 77 61 70 70 69 |mory.M.M|E.Swappi|
|00004dd0| 6e 67 4d 4d 55 4d 6f 64 | 65 0d 52 65 76 69 73 65 |ngMMUMod|e.Revise|
|00004de0| 64 20 62 79 3a 09 41 6e | 64 72 65 77 20 53 68 65 |d by:.An|drew She|
|00004df0| 62 61 6e 6f 77 09 46 65 | 62 72 75 61 72 79 20 31 |banow.Fe|bruary 1|
|00004e00| 39 39 30 0d 57 72 69 74 | 74 65 6e 20 62 79 3a 09 |990.Writ|ten by:.|
|00004e10| 43 61 6d 65 72 6f 6e 20 | 42 69 72 73 65 09 41 70 |Cameron |Birse.Ap|
|00004e20| 72 69 6c 20 31 39 38 39 | 0d 54 68 69 73 20 54 65 |ril 1989|.This Te|
|00004e30| 63 68 6e 69 63 61 6c 20 | 4e 6f 74 65 20 64 65 73 |chnical |Note des|
|00004e40| 63 72 69 62 65 73 20 68 | 6f 77 20 74 6f 20 61 76 |cribes h|ow to av|
|00004e50| 6f 69 64 20 63 72 61 73 | 68 69 6e 67 20 77 68 65 |oid cras|hing whe|
|00004e60| 6e 20 73 77 61 70 70 69 | 6e 67 20 69 6e 74 6f 20 |n swappi|ng into |
|00004e70| 33 32 2d 62 69 74 20 6d | 6f 64 65 20 6f 6e 20 61 |32-bit m|ode on a|
|00004e80| 20 4d 61 63 69 6e 74 6f | 73 68 20 49 49 2e 20 20 | Macinto|sh II. |
|00004e90| 54 68 61 6e 6b 73 20 74 | 6f 20 4a 69 6d 20 42 65 |Thanks t|o Jim Be|
|00004ea0| 72 72 79 20 61 6e 64 20 | 44 61 6e 20 57 65 73 74 |rry and |Dan West|
|00004eb0| 6f 6e 20 66 6f 72 20 70 | 6f 69 6e 74 69 6e 67 20 |on for p|ointing |
|00004ec0| 74 68 69 73 20 6f 75 74 | 2e 0d 43 68 61 6e 67 65 |this out|..Change|
|00004ed0| 73 20 73 69 6e 63 65 20 | 41 70 72 69 6c 20 31 39 |s since |April 19|
|00004ee0| 38 39 3a 20 20 41 64 64 | 65 64 20 61 20 72 65 66 |89: Add|ed a ref|
|00004ef0| 65 72 65 6e 63 65 20 74 | 6f 20 54 65 63 68 6e 69 |erence t|o Techni|
|00004f00| 63 61 6c 20 4e 6f 74 65 | 20 23 32 31 33 2c 20 5f |cal Note| #213, _|
|00004f10| 53 74 72 69 70 41 64 64 | 72 65 73 73 3a 20 20 54 |StripAdd|ress: T|
|00004f20| 68 65 20 55 6e 74 6f 6c | 64 20 53 74 6f 72 79 2e |he Untol|d Story.|
|00004f30| 0d 54 68 65 72 65 20 69 | 73 20 61 20 63 6f 6e 64 |.There i|s a cond|
|00004f40| 69 74 69 6f 6e 20 77 68 | 65 72 65 20 63 61 6c 6c |ition wh|ere call|
|00004f50| 69 6e 67 20 5f 53 77 61 | 70 4d 4d 55 4d 6f 64 65 |ing _Swa|pMMUMode|
|00004f60| 20 74 6f 20 73 77 69 74 | 63 68 20 74 68 65 20 4d | to swit|ch the M|
|00004f70| 61 63 69 6e 74 6f 73 68 | 20 49 49 20 69 6e 74 6f |acintosh| II into|
|00004f80| 20 33 32 2d 62 69 74 20 | 6d 6f 64 65 20 63 61 6e | 32-bit |mode can|
|00004f90| 20 63 61 75 73 65 20 74 | 68 65 20 73 79 73 74 65 | cause t|he syste|
|00004fa0| 6d 20 74 6f 20 63 72 61 | 73 68 2e 20 20 54 68 69 |m to cra|sh. Thi|
|00004fb0| 73 20 63 6f 6e 64 69 74 | 69 6f 6e 20 68 61 70 70 |s condit|ion happ|
|00004fc0| 65 6e 73 20 69 6e 20 63 | 6f 64 65 20 77 68 69 63 |ens in c|ode whic|
|00004fd0| 68 20 69 73 20 6c 6f 61 | 64 65 64 20 69 6e 74 6f |h is loa|ded into|
|00004fe0| 20 6d 65 6d 6f 72 79 20 | 66 72 6f 6d 20 61 20 72 | memory |from a r|
|00004ff0| 65 73 6f 75 72 63 65 2c | 20 6f 72 20 69 73 20 70 |esource,| or is p|
|00005000| 6c 61 63 65 64 20 69 6e | 20 6d 65 6d 6f 72 79 20 |laced in| memory |
|00005010| 74 68 61 74 20 77 61 73 | 20 61 6c 6c 6f 63 61 74 |that was| allocat|
|00005020| 65 64 20 62 79 20 74 68 | 65 20 4d 65 6d 6f 72 79 |ed by th|e Memory|
|00005030| 20 4d 61 6e 61 67 65 72 | 20 61 6e 64 20 69 73 20 | Manager| and is |
|00005040| 73 75 62 73 65 71 75 65 | 6e 74 6c 79 20 65 78 65 |subseque|ntly exe|
|00005050| 63 75 74 65 64 20 62 79 | 20 75 73 69 6e 67 20 74 |cuted by| using t|
|00005060| 68 65 20 6d 61 73 74 65 | 72 20 70 6f 69 6e 74 65 |he maste|r pointe|
|00005070| 72 20 61 73 20 74 68 65 | 20 61 64 64 72 65 73 73 |r as the| address|
|00005080| 20 66 6f 72 20 61 20 4a | 53 52 20 69 6e 73 74 72 | for a J|SR instr|
|00005090| 75 63 74 69 6f 6e 2e 20 | 20 54 68 69 73 20 63 6f |uction. | This co|
|000050a0| 6e 64 69 74 69 6f 6e 20 | 69 6e 63 6c 75 64 65 73 |ndition |includes|
|000050b0| 20 73 74 61 6e 64 2d 61 | 6c 6f 6e 65 2c 20 65 78 | stand-a|lone, ex|
|000050c0| 65 63 75 74 61 62 6c 65 | 20 63 6f 64 65 20 72 65 |ecutable| code re|
|000050d0| 73 6f 75 72 63 65 73 20 | 28 69 2e 65 2e 2c 20 27 |sources |(i.e., '|
|000050e0| 58 43 4d 44 27 2c 20 27 | 58 46 43 4e 27 2c 20 27 |XCMD', '|XFCN', '|
|000050f0| 49 4e 49 54 27 2c 20 27 | 41 44 42 53 27 2c 27 46 |INIT', '|ADBS','F|
|00005100| 4b 45 59 27 2c 20 65 74 | 63 2e 29 2c 20 62 75 74 |KEY', et|c.), but|
|00005110| 20 64 6f 65 73 20 6e 6f | 74 20 61 70 70 6c 79 20 | does no|t apply |
|00005120| 74 6f 20 73 74 61 6e 64 | 61 72 64 20 27 43 4f 44 |to stand|ard 'COD|
|00005130| 45 27 20 72 65 73 6f 75 | 72 63 65 73 20 62 65 63 |E' resou|rces bec|
|00005140| 61 75 73 65 20 74 68 65 | 20 53 65 67 6d 65 6e 74 |ause the| Segment|
|00005150| 20 4c 6f 61 64 65 72 20 | 66 69 78 65 73 20 74 68 | Loader |fixes th|
|00005160| 65 20 50 43 2e 0d 57 68 | 65 6e 20 79 6f 75 20 6c |e PC..Wh|en you l|
|00005170| 6f 61 64 20 63 6f 64 65 | 20 69 6e 74 6f 20 6d 65 |oad code| into me|
|00005180| 6d 6f 72 79 20 61 73 20 | 61 20 72 65 73 6f 75 72 |mory as |a resour|
|00005190| 63 65 20 69 6e 20 32 34 | 2d 62 69 74 20 6d 6f 64 |ce in 24|-bit mod|
|000051a0| 65 20 28 69 2e 65 2e 2c | 20 62 79 20 63 61 6c 6c |e (i.e.,| by call|
|000051b0| 69 6e 67 20 5f 47 65 74 | 52 65 73 6f 75 72 63 65 |ing _Get|Resource|
|000051c0| 29 2c 20 74 68 65 20 68 | 69 67 68 20 62 79 74 65 |), the h|igh byte|
|000051d0| 20 6f 66 20 74 68 65 20 | 6d 61 73 74 65 72 20 70 | of the |master p|
|000051e0| 6f 69 6e 74 65 72 20 63 | 6f 6e 74 61 69 6e 73 20 |ointer c|ontains |
|000051f0| 4d 65 6d 6f 72 79 20 4d | 61 6e 61 67 65 72 20 69 |Memory M|anager i|
|00005200| 6e 66 6f 72 6d 61 74 69 | 6f 6e 2e 20 20 49 66 20 |nformati|on. If |
|00005210| 79 6f 75 20 70 65 72 66 | 6f 72 6d 20 61 20 4a 53 |you perf|orm a JS|
|00005220| 52 20 74 6f 20 74 68 65 | 20 63 6f 64 65 20 28 74 |R to the| code (t|
|00005230| 79 70 69 63 61 6c 6c 79 | 20 61 20 4a 53 52 20 28 |ypically| a JSR (|
|00005240| 41 30 29 20 77 69 74 68 | 20 74 68 65 20 6d 61 73 |A0) with| the mas|
|00005250| 74 65 72 20 70 6f 69 6e | 74 65 72 20 69 6e 20 41 |ter poin|ter in A|
|00005260| 30 29 2c 20 74 68 65 20 | 65 6e 74 69 72 65 20 6d |0), the |entire m|
|00005270| 61 73 74 65 72 20 70 6f | 69 6e 74 65 72 20 67 65 |aster po|inter ge|
|00005280| 74 73 20 74 72 61 6e 73 | 6c 61 74 65 64 20 64 69 |ts trans|lated di|
|00005290| 72 65 63 74 6c 79 20 69 | 6e 74 6f 20 74 68 65 20 |rectly i|nto the |
|000052a0| 70 72 6f 67 72 61 6d 20 | 63 6f 75 6e 74 65 72 2c |program |counter,|
|000052b0| 20 69 6e 63 6c 75 64 69 | 6e 67 20 74 68 65 20 68 | includi|ng the h|
|000052c0| 69 67 68 20 62 79 74 65 | 20 6f 66 20 4d 65 6d 6f |igh byte| of Memo|
|000052d0| 72 79 20 4d 61 6e 61 67 | 65 72 20 69 6e 66 6f 72 |ry Manag|er infor|
|000052e0| 6d 61 74 69 6f 6e 2e 20 | 20 41 73 20 73 6f 6f 6e |mation. | As soon|
|000052f0| 20 61 73 20 79 6f 75 20 | 73 77 69 74 63 68 20 69 | as you |switch i|
|00005300| 6e 74 6f 20 33 32 2d 62 | 69 74 20 6d 6f 64 65 2c |nto 32-b|it mode,|
|00005310| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 63 6f 75 | the pro|gram cou|
|00005320| 6e 74 65 72 20 65 66 66 | 65 63 74 69 76 65 6c 79 |nter eff|ectively|
|00005330| 20 68 61 73 20 67 61 72 | 62 61 67 65 20 69 6e 20 | has gar|bage in |
|00005340| 74 68 65 20 68 69 67 68 | 20 62 79 74 65 2c 20 61 |the high| byte, a|
|00005350| 6e 64 20 74 68 65 20 6d | 61 63 68 69 6e 65 20 67 |nd the m|achine g|
|00005360| 6f 65 73 20 64 69 72 65 | 63 74 6c 79 20 69 6e 74 |oes dire|ctly int|
|00005370| 6f 20 74 68 65 20 77 65 | 65 64 73 20 28 64 6f 20 |o the we|eds (do |
|00005380| 6e 6f 74 20 70 61 73 73 | 20 67 6f 2c 20 64 6f 20 |not pass| go, do |
|00005390| 6e 6f 74 20 63 6f 6c 6c | 65 63 74 20 24 32 30 30 |not coll|ect $200|
|000053a0| 29 2e 0d 59 6f 75 20 63 | 61 6e 20 61 76 6f 69 64 |)..You c|an avoid|
|000053b0| 20 74 68 69 73 20 70 72 | 6f 62 6c 65 6d 20 62 79 | this pr|oblem by|
|000053c0| 20 63 6c 65 61 6e 69 6e | 67 20 75 70 20 74 68 65 | cleanin|g up the|
|000053d0| 20 70 72 6f 67 72 61 6d | 20 63 6f 75 6e 74 65 72 | program| counter|
|000053e0| 20 66 72 6f 6d 20 77 69 | 74 68 69 6e 20 74 68 65 | from wi|thin the|
|000053f0| 20 72 65 73 6f 75 72 63 | 65 20 63 6f 64 65 20 62 | resourc|e code b|
|00005400| 65 66 6f 72 65 20 63 61 | 6c 6c 69 6e 67 20 5f 53 |efore ca|lling _S|
|00005410| 77 61 70 4d 4d 55 4d 6f | 64 65 2e 20 20 54 68 65 |wapMMUMo|de. The|
|00005420| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 65 78 61 6d 70 | followi|ng examp|
|00005430| 6c 65 20 73 68 6f 77 73 | 20 68 6f 77 20 74 6f 20 |le shows| how to |
|00005440| 63 6c 65 61 6e 20 75 70 | 20 74 68 65 20 50 43 20 |clean up| the PC |
|00005450| 75 73 69 6e 67 20 4d 50 | 57 20 50 61 73 63 61 6c |using MP|W Pascal|
|00005460| 20 61 6e 64 20 43 20 77 | 69 74 68 20 69 6e 6c 69 | and C w|ith inli|
|00005470| 6e 65 20 61 73 73 65 6d | 62 6c 79 20 63 6f 64 65 |ne assem|bly code|
|00005480| 3a 0d 4d 50 57 20 50 61 | 73 63 61 6c 0d 50 52 4f |:.MPW Pa|scal.PRO|
|00005490| 43 45 44 55 52 45 20 46 | 69 78 50 43 3b 0d 20 20 |CEDURE F|ixPC;. |
|000054a0| 20 20 49 4e 4c 49 4e 45 | 20 20 24 34 31 46 41 2c | INLINE| $41FA,|
|000054b0| 20 24 30 30 30 41 2c 20 | 20 7b 20 20 20 4c 45 41 | $000A, | { LEA|
|000054c0| 20 20 20 20 20 20 20 20 | 2a 2b 24 30 30 30 43 2c | |*+$000C,|
|000054d0| 41 30 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |A0 | |
|000054e0| 20 20 20 20 20 20 20 20 | 7d 0d 20 20 20 20 20 20 | |}. |
|000054f0| 20 20 20 20 20 20 24 32 | 30 30 38 2c 20 20 20 20 | $2|008, |
|00005500| 20 20 20 20 20 7b 20 20 | 20 4d 4f 56 45 2e 4c 20 | { | MOVE.L |
|00005510| 20 20 20 20 41 30 2c 44 | 30 20 20 20 20 20 20 20 | A0,D|0 |
|00005520| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005530| 20 20 20 20 7d 0d 20 20 | 20 20 20 20 20 20 20 20 | }. | |
|00005540| 20 20 24 41 30 35 35 2c | 20 20 20 20 20 20 20 20 | $A055,| |
|00005550| 20 7b 20 20 20 5f 53 74 | 72 69 70 41 64 64 72 65 | { _St|ripAddre|
|00005560| 73 73 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |ss | |
|00005570| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005580| 7d 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 24 32 |}. | $2|
|00005590| 30 34 30 2c 20 20 20 20 | 20 20 20 20 20 7b 20 20 |040, | { |
|000055a0| 20 4d 4f 56 45 41 2e 4c | 20 20 20 20 44 30 2c 41 | MOVEA.L| D0,A|
|000055b0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|000055c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 7d 0d 20 20 | | }. |
|000055d0| 20 20 20 20 20 20 20 20 | 20 20 24 34 45 44 30 3b | | $4ED0;|
|000055e0| 20 20 20 20 20 20 20 20 | 20 7b 20 20 20 4a 4d 50 | | { JMP|
|000055f0| 20 20 20 20 20 20 20 20 | 28 41 30 29 20 3b 6a 6d | |(A0) ;jm|
|00005600| 70 73 20 74 6f 20 6e 65 | 78 74 20 69 6e 73 74 72 |ps to ne|xt instr|
|00005610| 75 63 74 69 6f 6e 20 20 | 7d 0d 4d 50 57 20 43 0d |uction |}.MPW C.|
|00005620| 70 61 73 63 61 6c 20 76 | 6f 69 64 20 46 69 78 50 |pascal v|oid FixP|
|00005630| 43 28 29 0d 20 20 20 20 | 20 20 20 3d 20 7b 30 78 |C(). | = {0x|
|00005640| 34 31 46 41 2c 20 30 78 | 30 30 30 41 2c 20 20 2f |41FA, 0x|000A, /|
|00005650| 2a 20 20 20 4c 45 41 20 | 20 20 20 20 20 20 20 2a |* LEA | *|
|00005660| 2b 24 30 30 30 43 2c 41 | 30 20 20 20 20 20 20 20 |+$000C,A|0 |
|00005670| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2a 2f | | */|
|00005680| 0d 20 20 20 20 20 20 20 | 20 20 20 30 78 32 30 30 |. | 0x200|
|00005690| 38 2c 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 20 |8, | /* |
|000056a0| 20 4d 4f 56 45 2e 4c 20 | 20 20 20 20 41 30 2c 44 | MOVE.L | A0,D|
|000056b0| 30 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0 | |
|000056c0| 20 20 20 20 20 20 20 20 | 20 20 20 2a 2f 0d 20 20 | | */. |
|000056d0| 20 20 20 20 20 20 20 20 | 30 78 41 30 35 35 2c 20 | |0xA055, |
|000056e0| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 20 20 5f 53 | | /* _S|
|000056f0| 74 72 69 70 41 64 64 72 | 65 73 73 20 20 20 20 20 |tripAddr|ess |
|00005700| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005710| 20 20 20 20 20 20 20 20 | 2a 2f 0d 20 20 20 20 20 | |*/. |
|00005720| 20 20 20 20 20 30 78 32 | 30 34 30 2c 20 20 20 20 | 0x2|040, |
|00005730| 20 20 20 20 20 20 2f 2a | 20 20 20 4d 4f 56 45 41 | /*| MOVEA|
|00005740| 2e 4c 20 20 20 20 44 30 | 2c 41 30 20 20 20 20 20 |.L D0|,A0 |
|00005750| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005760| 20 20 20 20 20 2a 2f 0d | 20 20 20 20 20 20 20 20 | */.| |
|00005770| 20 20 30 78 34 45 44 30 | 7d 3b 20 20 20 20 20 20 | 0x4ED0|}; |
|00005780| 20 20 20 2f 2a 20 20 20 | 4a 4d 50 20 20 20 20 20 | /* |JMP |
|00005790| 20 20 20 28 41 30 29 20 | 3b 6a 6d 70 73 20 74 6f | (A0) |;jmps to|
|000057a0| 20 6e 65 78 74 20 69 6e | 73 74 72 75 63 74 69 6f | next in|structio|
|000057b0| 6e 20 2a 2f 0d 46 75 72 | 74 68 65 72 20 52 65 66 |n */.Fur|ther Ref|
|000057c0| 65 72 65 6e 63 65 3a 0d | a5 09 49 6e 73 69 64 65 |erence:.|..Inside|
|000057d0| 20 4d 61 63 69 6e 74 6f | 73 68 2c 20 56 6f 6c 75 | Macinto|sh, Volu|
|000057e0| 6d 65 20 56 2d 35 39 31 | 2c 20 4f 53 20 55 74 69 |me V-591|, OS Uti|
|000057f0| 6c 69 74 69 65 73 0d a5 | 09 54 65 63 68 6e 69 63 |lities..|.Technic|
|00005800| 61 6c 20 4e 6f 74 65 20 | 4d 2e 4d 45 2e 33 32 42 |al Note |M.ME.32B|
|00005810| 69 74 43 6c 65 61 6e 20 | d1 0d 09 09 20 54 68 65 |itClean |.... The|
|00005820| 20 4a 6f 79 20 6f 66 20 | 42 65 69 6e 67 20 33 32 | Joy of |Being 32|
|00005830| 2d 42 69 74 20 43 6c 65 | 61 6e 0d a5 09 54 65 63 |-Bit Cle|an...Tec|
|00005840| 68 6e 69 63 61 6c 20 4e | 6f 74 65 20 4d 2e 4d 45 |hnical N|ote M.ME|
|00005850| 2e 53 74 72 69 70 41 64 | 64 72 65 73 73 20 d1 0d |.StripAd|dress ..|
|00005860| 09 09 20 5f 53 74 72 69 | 70 41 64 64 72 65 73 73 |.. _Stri|pAddress|
|00005870| 3a 20 20 54 68 65 20 55 | 6e 74 6f 6c 64 20 53 74 |: The U|ntold St|
|00005880| 6f 72 79 0d 4d 45 20 38 | 20 2d 20 53 79 73 74 65 |ory.ME 8| - Syste|
|00005890| 6d 20 45 72 72 6f 72 20 | 33 33 2c 20 d2 7a 63 62 |m Error |33, .zcb|
|000058a0| 46 72 65 65 20 68 61 73 | 20 67 6f 6e 65 20 6e 65 |Free has| gone ne|
|000058b0| 67 61 74 69 76 65 d3 0d | 4d 65 6d 6f 72 79 09 4d |gative..|Memory.M|
|000058c0| 2e 4d 45 2e 53 79 73 45 | 72 72 6f 72 33 33 0d 52 |.ME.SysE|rror33.R|
|000058d0| 65 76 69 73 65 64 20 62 | 79 3a 09 09 4d 61 72 63 |evised b|y:..Marc|
|000058e0| 68 20 31 39 38 38 0d 57 | 72 69 74 74 65 6e 20 62 |h 1988.W|ritten b|
|000058f0| 79 3a 09 42 72 79 61 6e | 20 53 74 65 61 72 6e 73 |y:.Bryan| Stearns|
|00005900| 09 4a 75 6c 79 20 31 39 | 38 37 0d 53 79 73 74 65 |.July 19|87.Syste|
|00005910| 6d 20 33 2e 32 20 69 6e | 74 72 6f 64 75 63 65 64 |m 3.2 in|troduced|
|00005920| 20 61 20 6e 65 77 20 73 | 79 73 74 65 6d 20 65 72 | a new s|ystem er|
|00005930| 72 6f 72 2c 20 49 44 3d | 33 33 2c 20 67 65 6e 65 |ror, ID=|33, gene|
|00005940| 72 61 74 65 64 20 62 79 | 20 74 68 65 20 4d 65 6d |rated by| the Mem|
|00005950| 6f 72 79 20 4d 61 6e 61 | 67 65 72 20 77 68 65 6e |ory Mana|ger when|
|00005960| 20 69 74 20 6e 6f 74 69 | 63 65 73 20 74 68 61 74 | it noti|ces that|
|00005970| 20 61 20 68 65 61 70 20 | 68 61 64 20 62 65 65 6e | a heap |had been|
|00005980| 20 63 6f 72 72 75 70 74 | 65 64 20 69 6e 20 61 20 | corrupt|ed in a |
|00005990| 63 65 72 74 61 69 6e 20 | 77 61 79 2e 20 54 68 69 |certain |way. Thi|
|000059a0| 73 20 65 72 72 6f 72 20 | 69 73 20 6c 69 73 74 65 |s error |is liste|
|000059b0| 64 20 69 6e 20 74 68 65 | 20 66 69 6c 65 20 d2 53 |d in the| file .S|
|000059c0| 79 73 45 72 72 2e 61 d3 | 20 61 73 20 d2 6e 65 67 |ysErr.a.| as .neg|
|000059d0| 5a 63 62 46 72 65 65 45 | 72 72 d3 2e 0d 54 68 65 |ZcbFreeE|rr...The|
|000059e0| 20 4d 65 6d 6f 72 79 20 | 4d 61 6e 61 67 65 72 20 | Memory |Manager |
|000059f0| 77 69 6c 6c 20 74 72 69 | 67 67 65 72 20 61 6e 20 |will tri|gger an |
|00005a00| d2 49 44 3d 33 33 d3 20 | 73 79 73 74 65 6d 20 65 |.ID=33. |system e|
|00005a10| 72 72 6f 72 20 77 68 65 | 6e 2c 20 64 75 72 69 6e |rror whe|n, durin|
|00005a20| 67 20 73 6f 6d 65 20 6f | 70 65 72 61 74 69 6f 6e |g some o|peration|
|00005a30| 20 77 68 69 63 68 20 73 | 63 61 6e 73 20 74 68 65 | which s|cans the|
|00005a40| 20 6f 62 6a 65 63 74 73 | 20 69 6e 20 74 68 65 20 | objects| in the |
|00005a50| 68 65 61 70 2c 20 69 74 | 20 73 65 65 73 20 74 68 |heap, it| sees th|
|00005a60| 61 74 20 69 74 73 20 72 | 75 6e 6e 69 6e 67 20 63 |at its r|unning c|
|00005a70| 6f 75 6e 74 20 6f 66 20 | 66 72 65 65 20 62 79 74 |ount of |free byt|
|00005a80| 65 73 20 28 7a 63 62 46 | 72 65 65 2c 20 61 6e 20 |es (zcbF|ree, an |
|00005a90| 69 6e 74 65 72 6e 61 6c | 20 76 61 6c 75 65 29 20 |internal| value) |
|00005aa0| 68 61 73 20 62 65 63 6f | 6d 65 20 6e 65 67 61 74 |has beco|me negat|
|00005ab0| 69 76 65 20 28 61 6e 20 | 69 6d 70 6f 73 73 69 62 |ive (an |impossib|
|00005ac0| 6c 65 20 66 65 61 74 20 | 69 6e 20 6e 6f 72 6d 61 |le feat |in norma|
|00005ad0| 6c 20 6f 70 65 72 61 74 | 69 6f 6e 29 2e 20 54 68 |l operat|ion). Th|
|00005ae0| 69 73 20 69 73 20 6e 65 | 61 72 6c 79 20 61 6c 77 |is is ne|arly alw|
|00005af0| 61 79 73 20 63 61 75 73 | 65 64 20 62 79 20 77 72 |ays caus|ed by wr|
|00005b00| 69 74 69 6e 67 20 7a 65 | 72 6f 73 20 70 61 73 74 |iting ze|ros past|
|00005b10| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 6f 6e 65 20 | the end| of one |
|00005b20| 6f 66 20 74 68 65 20 4d | 65 6d 6f 72 79 20 4d 61 |of the M|emory Ma|
|00005b30| 6e 61 67 65 72 d5 73 20 | 68 65 61 70 20 62 6c 6f |nager.s |heap blo|
|00005b40| 63 6b 73 20 28 6f 76 65 | 72 77 72 69 74 69 6e 67 |cks (ove|rwriting|
|00005b50| 20 61 6e 64 20 63 6f 72 | 72 75 70 74 69 6e 67 20 | and cor|rupting |
|00005b60| 74 68 65 20 6e 65 78 74 | 20 62 6c 6f 63 6b d5 73 |the next| block.s|
|00005b70| 20 68 65 61 64 65 72 2c | 20 6d 61 6b 69 6e 67 20 | header,| making |
|00005b80| 69 74 20 61 70 70 65 61 | 72 20 74 6f 20 62 65 20 |it appea|r to be |
|00005b90| 61 20 66 72 65 65 20 62 | 6c 6f 63 6b 29 2e 0d 49 |a free b|lock)..I|
|00005ba0| 66 20 79 6f 75 20 67 65 | 74 20 74 68 69 73 20 65 |f you ge|t this e|
|00005bb0| 72 72 6f 72 2c 20 75 73 | 65 20 61 20 64 65 62 75 |rror, us|e a debu|
|00005bc0| 67 67 65 72 20 28 6c 69 | 6b 65 20 4d 61 63 73 62 |gger (li|ke Macsb|
|00005bd0| 75 67 20 6f 72 20 54 4d | 4f 4e 29 20 77 68 65 6e |ug or TM|ON) when|
|00005be0| 20 79 6f 75 20 61 74 74 | 65 6d 70 74 20 74 6f 20 | you att|empt to |
|00005bf0| 72 65 70 72 6f 64 75 63 | 65 20 74 68 65 20 65 72 |reproduc|e the er|
|00005c00| 72 6f 72 2c 20 74 6f 20 | 63 68 65 63 6b 20 74 68 |ror, to |check th|
|00005c10| 65 20 63 6f 6e 73 69 73 | 74 65 6e 63 79 20 6f 66 |e consis|tency of|
|00005c20| 20 74 68 65 20 68 65 61 | 70 20 75 70 20 74 6f 20 | the hea|p up to |
|00005c30| 74 68 65 20 70 6f 69 6e | 74 20 77 68 65 72 65 20 |the poin|t where |
|00005c40| 74 68 65 20 65 72 72 6f | 72 20 6f 63 63 75 72 73 |the erro|r occurs|
|00005c50| 2e 20 59 6f 75 20 6d 61 | 79 20 6e 65 65 64 20 74 |. You ma|y need t|
|00005c60| 6f 20 64 6f 20 74 68 69 | 73 20 72 65 70 65 61 74 |o do thi|s repeat|
|00005c70| 65 64 6c 79 20 75 6e 74 | 69 6c 20 79 6f 75 20 69 |edly unt|il you i|
|00005c80| 73 6f 6c 61 74 65 20 74 | 68 65 20 6f 70 65 72 61 |solate t|he opera|
|00005c90| 74 69 6f 6e 20 74 68 61 | 74 20 69 73 20 63 6f 72 |tion tha|t is cor|
|00005ca0| 72 75 70 74 69 6e 67 20 | 74 68 65 20 68 65 61 70 |rupting |the heap|
|00005cb0| 2e 0d 4e 6f 74 65 20 74 | 68 61 74 20 61 6c 74 68 |..Note t|hat alth|
|00005cc0| 6f 75 67 68 20 74 68 65 | 20 68 65 61 70 20 6d 61 |ough the| heap ma|
|00005cd0| 79 20 62 65 63 6f 6d 65 | 20 63 6f 72 72 75 70 74 |y become| corrupt|
|00005ce0| 65 64 20 64 75 72 69 6e | 67 20 61 20 73 79 73 74 |ed durin|g a syst|
|00005cf0| 65 6d 20 63 61 6c 6c 2c | 20 74 68 69 73 20 64 6f |em call,| this do|
|00005d00| 65 73 6e d5 74 20 6d 65 | 61 6e 20 79 6f 75 d5 76 |esn.t me|an you.v|
|00005d10| 65 20 66 6f 75 6e 64 20 | 61 20 62 75 67 20 69 6e |e found |a bug in|
|00005d20| 20 74 68 65 20 52 4f 4d | 3b 20 79 6f 75 72 20 63 | the ROM|; your c|
|00005d30| 6f 64 65 20 63 6f 75 6c | 64 20 62 65 20 70 61 73 |ode coul|d be pas|
|00005d40| 73 69 6e 67 20 69 6e 63 | 6f 72 72 65 63 74 20 6f |sing inc|orrect o|
|00005d50| 72 20 69 6e 76 61 6c 69 | 64 20 70 61 72 61 6d 65 |r invali|d parame|
|00005d60| 74 65 72 73 20 74 6f 20 | 74 68 69 73 20 6f 72 20 |ters to |this or |
|00005d70| 61 20 70 72 65 76 69 6f | 75 73 20 73 79 73 74 65 |a previo|us syste|
|00005d80| 6d 20 63 61 6c 6c 2c 20 | 6f 72 20 63 6f 75 6c 64 |m call, |or could|
|00005d90| 20 68 61 76 65 20 63 6f | 72 72 75 70 74 65 64 20 | have co|rrupted |
|00005da0| 61 20 64 61 74 61 20 73 | 74 72 75 63 74 75 72 65 |a data s|tructure|
|00005db0| 20 75 73 65 64 20 62 79 | 20 61 20 73 79 73 74 65 | used by| a syste|
|00005dc0| 6d 20 63 61 6c 6c 2e 20 | 4d 6f 72 65 20 64 65 62 |m call. |More deb|
|00005dd0| 75 67 67 69 6e 67 20 69 | 73 20 75 73 75 61 6c 6c |ugging i|s usuall|
|00005de0| 79 20 69 6e 20 6f 72 64 | 65 72 20 69 6e 20 74 68 |y in ord|er in th|
|00005df0| 69 73 20 63 61 73 65 3b | 20 74 6f 6f 6c 73 20 6c |is case;| tools l|
|00005e00| 69 6b 65 20 44 69 73 63 | 69 70 6c 69 6e 65 20 28 |ike Disc|ipline (|
|00005e10| 69 6e 63 6c 75 64 65 64 | 20 69 6e 20 54 4d 4f 4e |included| in TMON|
|00005e20| 3b 20 61 6c 73 6f 20 61 | 76 61 69 6c 61 62 6c 65 |; also a|vailable|
|00005e30| 20 66 72 6f 6d 20 75 73 | 65 72 73 d5 20 67 72 6f | from us|ers. gro|
|00005e40| 75 70 73 20 61 6e 64 20 | 65 6c 65 63 74 72 6f 6e |ups and |electron|
|00005e50| 69 63 20 73 65 72 76 69 | 63 65 73 29 20 63 61 6e |ic servi|ces) can|
|00005e60| 20 68 65 6c 70 20 64 65 | 74 65 63 74 20 69 6e 76 | help de|tect inv|
|00005e70| 61 6c 69 64 20 70 61 72 | 61 6d 65 74 65 72 73 20 |alid par|ameters |
|00005e80| 69 6e 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 2e |in syste|m calls.|
|00005e90| 20 41 6c 73 6f 2c 20 74 | 68 65 72 65 20 69 73 20 | Also, t|here is |
|00005ea0| 61 20 4d 61 63 73 62 75 | 67 20 63 6f 6d 6d 61 6e |a Macsbu|g comman|
|00005eb0| 64 2c 20 41 48 2c 20 74 | 68 61 74 20 63 61 6e 20 |d, AH, t|hat can |
|00005ec0| 63 68 65 63 6b 20 74 68 | 65 20 63 6f 6e 73 69 73 |check th|e consis|
|00005ed0| 74 65 6e 63 79 20 6f 66 | 20 74 68 65 20 68 65 61 |tency of| the hea|
|00005ee0| 70 20 6f 6e 20 65 76 65 | 72 79 20 73 79 73 74 65 |p on eve|ry syste|
|00005ef0| 6d 20 63 61 6c 6c 2e 20 | 53 65 65 20 74 68 65 20 |m call. |See the |
|00005f00| 64 6f 63 75 6d 65 6e 74 | 61 74 69 6f 6e 20 74 68 |document|ation th|
|00005f10| 61 74 20 63 61 6d 65 20 | 77 69 74 68 20 79 6f 75 |at came |with you|
|00005f20| 72 20 64 65 62 75 67 67 | 65 72 20 74 6f 20 73 65 |r debugg|er to se|
|00005f30| 65 20 77 68 61 74 20 73 | 70 65 63 69 61 6c 20 66 |e what s|pecial f|
|00005f40| 65 61 74 75 72 65 73 20 | 69 74 20 6f 66 66 65 72 |eatures |it offer|
|00005f50| 73 2e 0d 41 20 6e 6f 74 | 65 20 61 62 6f 75 74 20 |s..A not|e about |
|00005f60| d2 53 79 73 45 72 72 2e | 61 d3 0d 54 65 63 68 6e |.SysErr.|a..Techn|
|00005f70| 69 63 61 6c 20 53 75 70 | 70 6f 72 74 20 69 73 20 |ical Sup|port is |
|00005f80| 6f 66 74 65 6e 20 61 73 | 6b 65 64 20 66 6f 72 20 |often as|ked for |
|00005f90| 61 6e 20 75 70 2d 74 6f | 2d 64 61 74 65 20 6c 69 |an up-to|-date li|
|00005fa0| 73 74 20 6f 66 20 65 72 | 72 6f 72 20 63 6f 64 65 |st of er|ror code|
|00005fb0| 73 2e 20 49 6e 20 67 65 | 6e 65 72 61 6c 2c 20 74 |s. In ge|neral, t|
|00005fc0| 68 69 73 20 69 73 20 70 | 72 6f 76 69 64 65 64 20 |his is p|rovided |
|00005fd0| 69 6e 20 d2 53 79 73 45 | 72 72 2e 61 d3 2c 20 74 |in .SysE|rr.a., t|
|00005fe0| 68 65 20 66 69 6c 65 20 | 6f 66 20 65 72 72 6f 72 |he file |of error|
|00005ff0| 20 6e 75 6d 62 65 72 73 | 20 73 68 69 70 70 65 64 | numbers| shipped|
|00006000| 20 77 69 74 68 20 74 68 | 65 20 6d 6f 73 74 20 63 | with th|e most c|
|00006010| 75 72 72 65 6e 74 20 76 | 65 72 73 69 6f 6e 20 6f |urrent v|ersion o|
|00006020| 66 20 4d 50 57 2e 20 41 | 64 6d 69 74 74 65 64 6c |f MPW. A|dmittedl|
|00006030| 79 2c 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 61 |y, the d|ocumenta|
|00006040| 74 69 6f 6e 20 76 61 6c | 75 65 20 6f 66 20 d2 53 |tion val|ue of .S|
|00006050| 79 73 45 72 72 2e 61 d3 | 20 69 73 20 73 6f 6d 65 |ysErr.a.| is some|
|00006060| 74 69 6d 65 73 20 6c 6f | 77 20 28 61 73 20 69 6e |times lo|w (as in|
|00006070| 20 74 68 65 20 63 61 73 | 65 20 6f 66 20 6e 65 67 | the cas|e of neg|
|00006080| 5a 43 42 46 72 65 65 45 | 72 72 29 2c 20 62 75 74 |ZCBFreeE|rr), but|
|00006090| 20 69 74 20 6d 61 79 20 | 67 69 76 65 20 79 6f 75 | it may |give you|
|000060a0| 20 61 20 63 6c 75 65 20 | 61 73 20 74 6f 20 77 68 | a clue |as to wh|
|000060b0| 61 74 20 74 68 65 20 65 | 72 72 6f 72 20 6d 69 67 |at the e|rror mig|
|000060c0| 68 74 20 6d 65 61 6e 2e | 0d 46 75 72 74 68 65 72 |ht mean.|.Further|
|000060d0| 20 52 65 66 65 72 65 6e | 63 65 3a 0d a5 09 54 68 | Referen|ce:...Th|
|000060e0| 65 20 4d 65 6d 6f 72 79 | 20 4d 61 6e 61 67 65 72 |e Memory| Manager|
|000060f0| 0d 4d 45 20 39 20 2d 20 | 43 6f 70 69 6e 67 20 57 |.ME 9 - |Coping W|
|00006100| 69 74 68 20 56 4d 20 61 | 6e 64 20 4d 65 6d 6f 72 |ith VM a|nd Memor|
|00006110| 79 20 4d 61 70 70 69 6e | 67 73 0d 4d 65 6d 6f 72 |y Mappin|gs.Memor|
|00006120| 79 09 4d 2e 4d 45 2e 56 | 4d 4d 65 6d 6f 72 79 4d |y.M.ME.V|MMemoryM|
|00006130| 61 70 70 69 6e 67 0d 52 | 65 76 69 73 65 64 20 62 |apping.R|evised b|
|00006140| 79 3a 09 43 72 61 69 67 | 20 50 72 6f 75 73 65 09 |y:.Craig| Prouse.|
|00006150| 41 70 72 69 6c 20 31 39 | 39 31 0d 57 72 69 74 74 |April 19|91.Writt|
|00006160| 65 6e 20 62 79 3a 09 43 | 72 61 69 67 20 50 72 6f |en by:.C|raig Pro|
|00006170| 75 73 65 09 46 65 62 72 | 75 61 72 79 20 31 39 39 |use.Febr|uary 199|
|00006180| 31 0d 54 68 65 20 70 75 | 72 70 6f 73 65 20 6f 66 |1.The pu|rpose of|
|00006190| 20 74 68 69 73 20 4e 6f | 74 65 20 69 73 20 74 77 | this No|te is tw|
|000061a0| 6f 66 6f 6c 64 2e 20 20 | 46 69 72 73 74 2c 20 69 |ofold. |First, i|
|000061b0| 74 20 64 65 73 63 72 69 | 62 65 73 20 69 6e 20 64 |t descri|bes in d|
|000061c0| 65 74 61 69 6c 20 68 6f | 77 20 74 6f 20 75 73 65 |etail ho|w to use|
|000061d0| 20 74 68 65 20 47 65 74 | 50 68 79 73 69 63 61 6c | the Get|Physical|
|000061e0| 20 72 6f 75 74 69 6e 65 | 2e 20 20 54 68 69 73 20 | routine|. This |
|000061f0| 72 6f 75 74 69 6e 65 20 | 69 73 20 63 72 69 74 69 |routine |is criti|
|00006200| 63 61 6c 20 74 6f 20 74 | 68 65 20 73 75 70 70 6f |cal to t|he suppo|
|00006210| 72 74 20 6f 66 20 61 6c | 74 65 72 6e 61 74 65 20 |rt of al|ternate |
|00006220| 62 75 73 20 6d 61 73 74 | 65 72 73 20 6f 6e 20 63 |bus mast|ers on c|
|00006230| 65 72 74 61 69 6e 20 6d | 61 63 68 69 6e 65 73 20 |ertain m|achines |
|00006240| 77 69 74 68 6f 75 74 20 | 56 69 72 74 75 61 6c 20 |without |Virtual |
|00006250| 4d 65 6d 6f 72 79 20 28 | 56 4d 29 20 61 6e 64 20 |Memory (|VM) and |
|00006260| 61 6c 6c 20 6d 61 63 68 | 69 6e 65 73 20 77 69 74 |all mach|ines wit|
|00006270| 68 20 56 4d 2e 20 20 49 | 6e 63 6c 75 64 65 64 20 |h VM. I|ncluded |
|00006280| 69 73 20 61 6e 20 61 6e | 63 69 6c 6c 61 72 79 20 |is an an|cillary |
|00006290| 64 69 73 63 75 73 73 69 | 6f 6e 20 6f 66 20 73 65 |discussi|on of se|
|000062a0| 76 65 72 61 6c 20 63 6c | 6f 73 65 6c 79 2d 72 65 |veral cl|osely-re|
|000062b0| 6c 61 74 65 64 20 56 4d | 20 72 6f 75 74 69 6e 65 |lated VM| routine|
|000062c0| 73 2e 20 20 53 65 63 6f | 6e 64 2c 20 69 74 20 72 |s. Seco|nd, it r|
|000062d0| 65 69 74 65 72 61 74 65 | 73 20 61 20 6e 75 6d 62 |eiterate|s a numb|
|000062e0| 65 72 20 6f 66 20 69 73 | 73 75 65 73 20 69 6d 70 |er of is|sues imp|
|000062f0| 6f 72 74 61 6e 74 20 74 | 6f 20 56 4d 20 63 6f 6d |ortant t|o VM com|
|00006300| 70 61 74 69 62 69 6c 69 | 74 79 20 61 6e 64 20 65 |patibili|ty and e|
|00006310| 6c 75 63 69 64 61 74 65 | 73 20 73 6f 6d 65 20 6f |lucidate|s some o|
|00006320| 66 20 74 68 65 20 64 65 | 65 70 65 72 20 56 4d 20 |f the de|eper VM |
|00006330| 69 73 73 75 65 73 20 6f | 66 20 77 68 69 63 68 20 |issues o|f which |
|00006340| 73 70 65 63 69 61 6c 69 | 7a 65 64 20 64 65 76 65 |speciali|zed deve|
|00006350| 6c 6f 70 65 72 73 20 73 | 68 6f 75 6c 64 20 62 65 |lopers s|hould be|
|00006360| 20 61 77 61 72 65 2e 20 | 20 43 6f 6d 70 61 74 69 | aware. | Compati|
|00006370| 62 69 6c 69 74 79 20 69 | 73 73 75 65 73 20 61 72 |bility i|ssues ar|
|00006380| 65 20 65 73 70 65 63 69 | 61 6c 6c 79 20 69 6d 70 |e especi|ally imp|
|00006390| 6f 72 74 61 6e 74 20 66 | 6f 72 20 64 65 76 65 6c |ortant f|or devel|
|000063a0| 6f 70 65 72 73 20 6f 66 | 20 53 43 53 49 20 64 72 |opers of| SCSI dr|
|000063b0| 69 76 65 72 73 2c 20 4e | 75 42 75 73 aa 20 6d 61 |ivers, N|uBus. ma|
|000063c0| 73 74 65 72 20 68 61 72 | 64 77 61 72 65 2c 20 61 |ster har|dware, a|
|000063d0| 6e 64 20 63 6f 64 65 20 | 77 68 69 63 68 20 72 75 |nd code |which ru|
|000063e0| 6e 73 20 61 74 20 69 6e | 74 65 72 72 75 70 74 20 |ns at in|terrupt |
|000063f0| 74 69 6d 65 2e 0d 43 68 | 61 6e 67 65 73 20 73 69 |time..Ch|anges si|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.